-
Notifications
You must be signed in to change notification settings - Fork 12.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Assume that type node annotations resolving to error types can be reu…
…sed (#60195) Co-authored-by: Jake Bailey <[email protected]>
- Loading branch information
1 parent
f53d6dd
commit c003609
Showing
8 changed files
with
133 additions
and
14 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
14 changes: 14 additions & 0 deletions
14
tests/baselines/reference/isolatedDeclarationErrorTypes1.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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
isolatedDeclarationErrorTypes1.ts(3,28): error TS2307: Cannot find module 'foo' or its corresponding type declarations. | ||
|
||
|
||
==== isolatedDeclarationErrorTypes1.ts (1 errors) ==== | ||
// https://github.com/microsoft/TypeScript/issues/60192 | ||
|
||
import { Unresolved } from "foo"; | ||
~~~~~ | ||
!!! error TS2307: Cannot find module 'foo' or its corresponding type declarations. | ||
|
||
export const foo1 = (type?: Unresolved): void => {}; | ||
export const foo2 = (type?: Unresolved | undefined): void => {}; | ||
export const foo3 = (type: Unresolved): void => {}; | ||
|
30 changes: 30 additions & 0 deletions
30
tests/baselines/reference/isolatedDeclarationErrorTypes1.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,30 @@ | ||
//// [tests/cases/compiler/isolatedDeclarationErrorTypes1.ts] //// | ||
|
||
//// [isolatedDeclarationErrorTypes1.ts] | ||
// https://github.com/microsoft/TypeScript/issues/60192 | ||
|
||
import { Unresolved } from "foo"; | ||
|
||
export const foo1 = (type?: Unresolved): void => {}; | ||
export const foo2 = (type?: Unresolved | undefined): void => {}; | ||
export const foo3 = (type: Unresolved): void => {}; | ||
|
||
|
||
//// [isolatedDeclarationErrorTypes1.js] | ||
"use strict"; | ||
// https://github.com/microsoft/TypeScript/issues/60192 | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.foo3 = exports.foo2 = exports.foo1 = void 0; | ||
const foo1 = (type) => { }; | ||
exports.foo1 = foo1; | ||
const foo2 = (type) => { }; | ||
exports.foo2 = foo2; | ||
const foo3 = (type) => { }; | ||
exports.foo3 = foo3; | ||
|
||
|
||
//// [isolatedDeclarationErrorTypes1.d.ts] | ||
import { Unresolved } from "foo"; | ||
export declare const foo1: (type?: Unresolved) => void; | ||
export declare const foo2: (type?: Unresolved | undefined) => void; | ||
export declare const foo3: (type: Unresolved) => void; |
23 changes: 23 additions & 0 deletions
23
tests/baselines/reference/isolatedDeclarationErrorTypes1.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,23 @@ | ||
//// [tests/cases/compiler/isolatedDeclarationErrorTypes1.ts] //// | ||
|
||
=== isolatedDeclarationErrorTypes1.ts === | ||
// https://github.com/microsoft/TypeScript/issues/60192 | ||
|
||
import { Unresolved } from "foo"; | ||
>Unresolved : Symbol(Unresolved, Decl(isolatedDeclarationErrorTypes1.ts, 2, 8)) | ||
|
||
export const foo1 = (type?: Unresolved): void => {}; | ||
>foo1 : Symbol(foo1, Decl(isolatedDeclarationErrorTypes1.ts, 4, 12)) | ||
>type : Symbol(type, Decl(isolatedDeclarationErrorTypes1.ts, 4, 21)) | ||
>Unresolved : Symbol(Unresolved, Decl(isolatedDeclarationErrorTypes1.ts, 2, 8)) | ||
|
||
export const foo2 = (type?: Unresolved | undefined): void => {}; | ||
>foo2 : Symbol(foo2, Decl(isolatedDeclarationErrorTypes1.ts, 5, 12)) | ||
>type : Symbol(type, Decl(isolatedDeclarationErrorTypes1.ts, 5, 21)) | ||
>Unresolved : Symbol(Unresolved, Decl(isolatedDeclarationErrorTypes1.ts, 2, 8)) | ||
|
||
export const foo3 = (type: Unresolved): void => {}; | ||
>foo3 : Symbol(foo3, Decl(isolatedDeclarationErrorTypes1.ts, 6, 12)) | ||
>type : Symbol(type, Decl(isolatedDeclarationErrorTypes1.ts, 6, 21)) | ||
>Unresolved : Symbol(Unresolved, Decl(isolatedDeclarationErrorTypes1.ts, 2, 8)) | ||
|
33 changes: 33 additions & 0 deletions
33
tests/baselines/reference/isolatedDeclarationErrorTypes1.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,33 @@ | ||
//// [tests/cases/compiler/isolatedDeclarationErrorTypes1.ts] //// | ||
|
||
=== isolatedDeclarationErrorTypes1.ts === | ||
// https://github.com/microsoft/TypeScript/issues/60192 | ||
|
||
import { Unresolved } from "foo"; | ||
>Unresolved : any | ||
> : ^^^ | ||
|
||
export const foo1 = (type?: Unresolved): void => {}; | ||
>foo1 : (type?: Unresolved) => void | ||
> : ^ ^^^ ^^^^^ | ||
>(type?: Unresolved): void => {} : (type?: Unresolved) => void | ||
> : ^ ^^^ ^^^^^ | ||
>type : any | ||
> : ^^^ | ||
|
||
export const foo2 = (type?: Unresolved | undefined): void => {}; | ||
>foo2 : (type?: Unresolved | undefined) => void | ||
> : ^ ^^^ ^^^^^ | ||
>(type?: Unresolved | undefined): void => {} : (type?: Unresolved | undefined) => void | ||
> : ^ ^^^ ^^^^^ | ||
>type : any | ||
> : ^^^ | ||
|
||
export const foo3 = (type: Unresolved): void => {}; | ||
>foo3 : (type: Unresolved) => void | ||
> : ^ ^^ ^^^^^ | ||
>(type: Unresolved): void => {} : (type: Unresolved) => void | ||
> : ^ ^^ ^^^^^ | ||
>type : Unresolved | ||
> : ^^^^^^^^^^ | ||
|
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,13 @@ | ||
// @isolatedDeclarations: true | ||
// @strict: true | ||
// @declaration: true | ||
// @moduleResolution: nodenext | ||
// @module: nodenext | ||
|
||
// https://github.com/microsoft/TypeScript/issues/60192 | ||
|
||
import { Unresolved } from "foo"; | ||
|
||
export const foo1 = (type?: Unresolved): void => {}; | ||
export const foo2 = (type?: Unresolved | undefined): void => {}; | ||
export const foo3 = (type: Unresolved): void => {}; |