-
-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
832 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
// See https://go.microsoft.com/fwlink/?LinkId=733558 | ||
// for the documentation about the tasks.json format | ||
"version": "2.0.0", | ||
"tasks": [ | ||
{ | ||
"type": "npm", | ||
"script": "watch", | ||
"group": { | ||
"kind": "build", | ||
"isDefault": true | ||
}, | ||
"problemMatcher": [] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
Feature: export namespace | ||
|
||
Background: | ||
Given file "a.ts" is | ||
""" | ||
export namespace constants { | ||
export enum flag { | ||
int: "int" | ||
} | ||
} | ||
export const A = 1; | ||
export const A_unused = 1; | ||
""" | ||
|
||
Scenario: Import A only | ||
Given file "b.ts" is import { A } from './a'; | ||
When analyzing "tsconfig.json" with files ["--searchNamespaces"] | ||
Then the result is { "a.ts": ["constants", "constants.flag", "A_unused"] } | ||
|
||
Scenario: Import namespace only | ||
Given file "b.ts" is import { A, constants } from './a'; | ||
When analyzing "tsconfig.json" with files ["--searchNamespaces"] | ||
Then the result is { "a.ts": ["constants.flag", "A_unused"] } | ||
|
||
Scenario: Import namespace and use the inner type | ||
Given file "b.ts" is | ||
""" | ||
import { A, constants } from './a'; | ||
const b: constants.flag; | ||
""" | ||
When analyzing "tsconfig.json" with files ["--searchNamespaces"] | ||
Then the result is { "a.ts": ["A_unused"] } | ||
|
||
# note: TypeScript cannot export default with or from within a namespace: | ||
# "A default export can only be used in an ECMAScript-style module." | ||
# | ||
# So - no need for a test like "Dynamically import namespace and use the inner type" | ||
|
||
Scenario: Import from nested namespace and use the inner type | ||
Given file "b.ts" is | ||
""" | ||
import { A, constants } from './a'; | ||
export namespace B_top | ||
{ | ||
export const B_inner_1 = 1; | ||
export namespace B_inner | ||
{ | ||
export const B_inner_2 = 1; | ||
export const B_inner_unused = 1; | ||
} | ||
export namespace B_unused | ||
{ | ||
export type B_unused_unused = {}; | ||
} | ||
} | ||
const b: constants.flag; | ||
""" | ||
And file "c.ts" is | ||
""" | ||
import { B_top } from './b'; | ||
const c1: B_top.B_inner_1; | ||
const c2: B_top.B_inner.B_inner_2; | ||
""" | ||
When analyzing "tsconfig.json" with files ["--searchNamespaces"] | ||
Then the result is { "a.ts": ["A_unused"], "b.ts": [ "B_top.B_inner.B_inner_unused", "B_top.B_unused", "B_top.B_unused.B_unused_unused"] } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.