File: findAllRefsImportDefault.ts

package info (click to toggle)
node-typescript 4.1.3-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 396,552 kB
  • sloc: javascript: 1,444,377; makefile: 7; sh: 3
file content (18 lines) | stat: -rw-r--r-- 1,036 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/// <reference path='fourslash.ts' />

// @Filename: f.ts
////[|export { [|{| "contextRangeIndex": 0 |}foo|] as [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}default|] };|]
////[|function /*start*/[|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 3 |}foo|](a: number, b: number) {
////    return a + b;
////}|]

// @Filename: b.ts
////[|import [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 5 |}bar|] from "./f";|]
////[|bar|](1, 2);

verify.noErrors();
const [ foo0Def, foo0, foo1, foo2Def, foo2, bar0Def, bar0, bar1 ] = test.ranges();
const fooGroup = { definition: "function foo(a: number, b: number): number", ranges: [foo0, foo2] };
const exportDefaultGroup = { definition: "(alias) function foo(a: number, b: number): number\nexport default", ranges: [foo1] };
const barGroup = { definition: "(alias) function bar(a: number, b: number): number\nimport bar", ranges: [bar0, bar1]};
verify.referenceGroups("start", [fooGroup, exportDefaultGroup, barGroup]);