-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Check the type expression of `@type` tags * Update existing tests and baselines
- Loading branch information
Showing
10 changed files
with
96 additions
and
9 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
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,21 @@ | ||
tests/cases/conformance/jsdoc/test.js(5,14): error TS2344: Type 'number' does not satisfy the constraint 'string'. | ||
tests/cases/conformance/jsdoc/test.js(7,14): error TS2344: Type 'number' does not satisfy the constraint 'string'. | ||
|
||
|
||
==== tests/cases/conformance/jsdoc/t.d.ts (0 errors) ==== | ||
type A<T extends string> = { a: T } | ||
|
||
==== tests/cases/conformance/jsdoc/test.js (2 errors) ==== | ||
/** Also should error for jsdoc typedefs | ||
* @template {string} U | ||
* @typedef {{ b: U }} B | ||
*/ | ||
/** @type {A<number>} */ | ||
~~~~~~ | ||
!!! error TS2344: Type 'number' does not satisfy the constraint 'string'. | ||
var a; | ||
/** @type {B<number>} */ | ||
~~~~~~ | ||
!!! error TS2344: Type 'number' does not satisfy the constraint 'string'. | ||
var b; | ||
|
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,20 @@ | ||
=== tests/cases/conformance/jsdoc/t.d.ts === | ||
type A<T extends string> = { a: T } | ||
>A : Symbol(A, Decl(t.d.ts, 0, 0)) | ||
>T : Symbol(T, Decl(t.d.ts, 0, 7)) | ||
>a : Symbol(a, Decl(t.d.ts, 0, 28)) | ||
>T : Symbol(T, Decl(t.d.ts, 0, 7)) | ||
|
||
=== tests/cases/conformance/jsdoc/test.js === | ||
/** Also should error for jsdoc typedefs | ||
* @template {string} U | ||
* @typedef {{ b: U }} B | ||
*/ | ||
/** @type {A<number>} */ | ||
var a; | ||
>a : Symbol(a, Decl(test.js, 5, 3)) | ||
|
||
/** @type {B<number>} */ | ||
var b; | ||
>b : Symbol(b, Decl(test.js, 7, 3)) | ||
|
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,20 @@ | ||
=== tests/cases/conformance/jsdoc/t.d.ts === | ||
type A<T extends string> = { a: T } | ||
>A : A<T> | ||
>T : T | ||
>a : T | ||
>T : T | ||
|
||
=== tests/cases/conformance/jsdoc/test.js === | ||
/** Also should error for jsdoc typedefs | ||
* @template {string} U | ||
* @typedef {{ b: U }} B | ||
*/ | ||
/** @type {A<number>} */ | ||
var a; | ||
>a : A<number> | ||
|
||
/** @type {B<number>} */ | ||
var b; | ||
>b : { b: number; } | ||
|
5 changes: 4 additions & 1 deletion
5
tests/baselines/reference/jsdocParameterParsingInfiniteLoop.errors.txt
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 |
---|---|---|
@@ -1,11 +1,14 @@ | ||
tests/cases/compiler/example.js(3,20): error TS1110: Type expected. | ||
tests/cases/compiler/example.js(3,21): error TS2304: Cannot find name 'foo'. | ||
|
||
|
||
==== tests/cases/compiler/example.js (1 errors) ==== | ||
==== tests/cases/compiler/example.js (2 errors) ==== | ||
// @ts-check | ||
/** | ||
* @type {function(@foo)} | ||
~ | ||
!!! error TS1110: Type expected. | ||
~~~ | ||
!!! error TS2304: Cannot find name 'foo'. | ||
*/ | ||
let x; |
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,16 @@ | ||
// @checkJs: true | ||
// @allowJs: true | ||
// @noEmit: true | ||
|
||
// @Filename: t.d.ts | ||
type A<T extends string> = { a: T } | ||
|
||
// @Filename: test.js | ||
/** Also should error for jsdoc typedefs | ||
* @template {string} U | ||
* @typedef {{ b: U }} B | ||
*/ | ||
/** @type {A<number>} */ | ||
var a; | ||
/** @type {B<number>} */ | ||
var b; |
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