forked from microsoft/TypeScript
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(58955): @import JSDoc tag doesn't seem to account for resolution-…
…mode import attribute in TS v5.5.2 (microsoft#58966)
- Loading branch information
1 parent
c76c418
commit c219989
Showing
7 changed files
with
159 additions
and
3 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
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,44 @@ | ||
/a.js(8,5): error TS2322: Type '1' is not assignable to type '"module"'. | ||
/a.js(15,5): error TS2322: Type '1' is not assignable to type '"script"'. | ||
|
||
|
||
==== /node_modules/@types/foo/package.json (0 errors) ==== | ||
{ | ||
"name": "@types/foo", | ||
"version": "1.0.0", | ||
"exports": { | ||
".": { | ||
"import": "./index.d.mts", | ||
"require": "./index.d.cts" | ||
} | ||
} | ||
} | ||
|
||
==== /node_modules/@types/foo/index.d.mts (0 errors) ==== | ||
export declare const Import: "module"; | ||
|
||
==== /node_modules/@types/foo/index.d.cts (0 errors) ==== | ||
export declare const Require: "script"; | ||
|
||
==== /a.js (2 errors) ==== | ||
/** @import { Import } from 'foo' with { 'resolution-mode': 'import' } */ | ||
/** @import { Require } from 'foo' with { 'resolution-mode': 'require' } */ | ||
|
||
/** | ||
* @returns { Import } | ||
*/ | ||
export function f1() { | ||
return 1; | ||
~~~~~~ | ||
!!! error TS2322: Type '1' is not assignable to type '"module"'. | ||
} | ||
|
||
/** | ||
* @returns { Require } | ||
*/ | ||
export function f2() { | ||
return 1; | ||
~~~~~~ | ||
!!! error TS2322: Type '1' is not assignable to type '"script"'. | ||
} | ||
|
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/conformance/jsdoc/importTag17.ts] //// | ||
|
||
=== /node_modules/@types/foo/index.d.mts === | ||
export declare const Import: "module"; | ||
>Import : Symbol(Import, Decl(index.d.mts, 0, 20)) | ||
|
||
=== /node_modules/@types/foo/index.d.cts === | ||
export declare const Require: "script"; | ||
>Require : Symbol(Require, Decl(index.d.cts, 0, 20)) | ||
|
||
=== /a.js === | ||
/** @import { Import } from 'foo' with { 'resolution-mode': 'import' } */ | ||
/** @import { Require } from 'foo' with { 'resolution-mode': 'require' } */ | ||
|
||
/** | ||
* @returns { Import } | ||
*/ | ||
export function f1() { | ||
>f1 : Symbol(f1, Decl(a.js, 0, 0)) | ||
|
||
return 1; | ||
} | ||
|
||
/** | ||
* @returns { Require } | ||
*/ | ||
export function f2() { | ||
>f2 : Symbol(f2, Decl(a.js, 8, 1)) | ||
|
||
return 1; | ||
} | ||
|
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,40 @@ | ||
//// [tests/cases/conformance/jsdoc/importTag17.ts] //// | ||
|
||
=== /node_modules/@types/foo/index.d.mts === | ||
export declare const Import: "module"; | ||
>Import : "module" | ||
> : ^^^^^^^^ | ||
|
||
=== /node_modules/@types/foo/index.d.cts === | ||
export declare const Require: "script"; | ||
>Require : "script" | ||
> : ^^^^^^^^ | ||
|
||
=== /a.js === | ||
/** @import { Import } from 'foo' with { 'resolution-mode': 'import' } */ | ||
/** @import { Require } from 'foo' with { 'resolution-mode': 'require' } */ | ||
|
||
/** | ||
* @returns { Import } | ||
*/ | ||
export function f1() { | ||
>f1 : () => "module" | ||
> : ^^^^^^^^^^^^^^ | ||
|
||
return 1; | ||
>1 : 1 | ||
> : ^ | ||
} | ||
|
||
/** | ||
* @returns { Require } | ||
*/ | ||
export function f2() { | ||
>f2 : () => "script" | ||
> : ^^^^^^^^^^^^^^ | ||
|
||
return 1; | ||
>1 : 1 | ||
> : ^ | ||
} | ||
|
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,40 @@ | ||
// @module: node16 | ||
// @checkJs: true | ||
// @allowJs: true | ||
// @noEmit: true | ||
|
||
// @Filename: /node_modules/@types/foo/package.json | ||
{ | ||
"name": "@types/foo", | ||
"version": "1.0.0", | ||
"exports": { | ||
".": { | ||
"import": "./index.d.mts", | ||
"require": "./index.d.cts" | ||
} | ||
} | ||
} | ||
|
||
// @Filename: /node_modules/@types/foo/index.d.mts | ||
export declare const Import: "module"; | ||
|
||
// @Filename: /node_modules/@types/foo/index.d.cts | ||
export declare const Require: "script"; | ||
|
||
// @Filename: /a.js | ||
/** @import { Import } from 'foo' with { 'resolution-mode': 'import' } */ | ||
/** @import { Require } from 'foo' with { 'resolution-mode': 'require' } */ | ||
|
||
/** | ||
* @returns { Import } | ||
*/ | ||
export function f1() { | ||
return 1; | ||
} | ||
|
||
/** | ||
* @returns { Require } | ||
*/ | ||
export function f2() { | ||
return 1; | ||
} |