forked from microsoft/TypeScript
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(47946): check literal types in export assignments with declared J…
…SDoc types (microsoft#47951)
- Loading branch information
1 parent
e64f04b
commit 0637148
Showing
5 changed files
with
93 additions
and
2 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
32 changes: 32 additions & 0 deletions
32
tests/baselines/reference/checkJsdocTypeTagOnExportAssignment8.js
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,32 @@ | ||
//// [tests/cases/compiler/checkJsdocTypeTagOnExportAssignment8.ts] //// | ||
|
||
//// [checkJsdocTypeTagOnExportAssignment8.js] | ||
|
||
//// [a.js] | ||
/** | ||
* @typedef Foo | ||
* @property {string} a | ||
* @property {'b'} b | ||
*/ | ||
|
||
/** @type {Foo} */ | ||
export default { | ||
a: 'a', | ||
b: 'b' | ||
} | ||
|
||
|
||
//// [checkJsdocTypeTagOnExportAssignment8.js] | ||
//// [a.js] | ||
"use strict"; | ||
/** | ||
* @typedef Foo | ||
* @property {string} a | ||
* @property {'b'} b | ||
*/ | ||
exports.__esModule = true; | ||
/** @type {Foo} */ | ||
exports["default"] = { | ||
a: 'a', | ||
b: 'b' | ||
}; |
18 changes: 18 additions & 0 deletions
18
tests/baselines/reference/checkJsdocTypeTagOnExportAssignment8.symbols
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,18 @@ | ||
=== tests/cases/compiler/checkJsdocTypeTagOnExportAssignment8.js === | ||
|
||
No type information for this code.=== tests/cases/compiler/a.js === | ||
/** | ||
* @typedef Foo | ||
* @property {string} a | ||
* @property {'b'} b | ||
*/ | ||
|
||
/** @type {Foo} */ | ||
export default { | ||
a: 'a', | ||
>a : Symbol(a, Decl(a.js, 7, 16)) | ||
|
||
b: 'b' | ||
>b : Symbol(b, Decl(a.js, 8, 11)) | ||
} | ||
|
22 changes: 22 additions & 0 deletions
22
tests/baselines/reference/checkJsdocTypeTagOnExportAssignment8.types
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,22 @@ | ||
=== tests/cases/compiler/checkJsdocTypeTagOnExportAssignment8.js === | ||
|
||
No type information for this code.=== tests/cases/compiler/a.js === | ||
/** | ||
* @typedef Foo | ||
* @property {string} a | ||
* @property {'b'} b | ||
*/ | ||
|
||
/** @type {Foo} */ | ||
export default { | ||
>{ a: 'a', b: 'b'} : { a: string; b: "b"; } | ||
|
||
a: 'a', | ||
>a : string | ||
>'a' : "a" | ||
|
||
b: 'b' | ||
>b : "b" | ||
>'b' : "b" | ||
} | ||
|
17 changes: 17 additions & 0 deletions
17
tests/cases/compiler/checkJsdocTypeTagOnExportAssignment8.ts
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,17 @@ | ||
// @allowJs: true | ||
// @checkJs: true | ||
// @outDir: ./out | ||
// @filename: checkJsdocTypeTagOnExportAssignment8.js | ||
|
||
// @Filename: a.js | ||
/** | ||
* @typedef Foo | ||
* @property {string} a | ||
* @property {'b'} b | ||
*/ | ||
|
||
/** @type {Foo} */ | ||
export default { | ||
a: 'a', | ||
b: 'b' | ||
} |