-
Notifications
You must be signed in to change notification settings - Fork 12.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🤖 Pick PR #58750 (Preserve elided imports used in dec...) into releas…
…e-5.5 (#58757) Co-authored-by: Titian Cernicova-Dragomir <[email protected]>
- Loading branch information
1 parent
4ee5d05
commit 35d2952
Showing
5 changed files
with
153 additions
and
11 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
45 changes: 45 additions & 0 deletions
45
tests/baselines/reference/declarationEmitPreserveReferencedImports.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,45 @@ | ||
//// [tests/cases/compiler/declarationEmitPreserveReferencedImports.ts] //// | ||
|
||
//// [utils.ts] | ||
export interface Evt { } | ||
|
||
|
||
//// [decl.ts] | ||
import {Evt} from './utils' | ||
export const o = <T>(o: T) => () : T => null! | ||
|
||
//// [main.ts] | ||
import { o } from './decl' | ||
import { Evt } from './utils' | ||
|
||
export const f = { o: o({ v: null! as Evt}) }; | ||
|
||
//// [utils.js] | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//// [decl.js] | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.o = void 0; | ||
var o = function (o) { return function () { return null; }; }; | ||
exports.o = o; | ||
//// [main.js] | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.f = void 0; | ||
var decl_1 = require("./decl"); | ||
exports.f = { o: (0, decl_1.o)({ v: null }) }; | ||
|
||
|
||
//// [utils.d.ts] | ||
export interface Evt { | ||
} | ||
//// [decl.d.ts] | ||
export declare const o: <T>(o: T) => () => T; | ||
//// [main.d.ts] | ||
import { Evt } from './utils'; | ||
export declare const f: { | ||
o: () => { | ||
v: Evt; | ||
}; | ||
}; |
32 changes: 32 additions & 0 deletions
32
tests/baselines/reference/declarationEmitPreserveReferencedImports.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,32 @@ | ||
//// [tests/cases/compiler/declarationEmitPreserveReferencedImports.ts] //// | ||
|
||
=== utils.ts === | ||
export interface Evt { } | ||
>Evt : Symbol(Evt, Decl(utils.ts, 0, 0)) | ||
|
||
|
||
=== decl.ts === | ||
import {Evt} from './utils' | ||
>Evt : Symbol(Evt, Decl(decl.ts, 0, 8)) | ||
|
||
export const o = <T>(o: T) => () : T => null! | ||
>o : Symbol(o, Decl(decl.ts, 1, 12)) | ||
>T : Symbol(T, Decl(decl.ts, 1, 18)) | ||
>o : Symbol(o, Decl(decl.ts, 1, 21)) | ||
>T : Symbol(T, Decl(decl.ts, 1, 18)) | ||
>T : Symbol(T, Decl(decl.ts, 1, 18)) | ||
|
||
=== main.ts === | ||
import { o } from './decl' | ||
>o : Symbol(o, Decl(main.ts, 0, 8)) | ||
|
||
import { Evt } from './utils' | ||
>Evt : Symbol(Evt, Decl(main.ts, 1, 8)) | ||
|
||
export const f = { o: o({ v: null! as Evt}) }; | ||
>f : Symbol(f, Decl(main.ts, 3, 12)) | ||
>o : Symbol(o, Decl(main.ts, 3, 18)) | ||
>o : Symbol(o, Decl(main.ts, 0, 8)) | ||
>v : Symbol(v, Decl(main.ts, 3, 25)) | ||
>Evt : Symbol(Evt, Decl(main.ts, 1, 8)) | ||
|
53 changes: 53 additions & 0 deletions
53
tests/baselines/reference/declarationEmitPreserveReferencedImports.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,53 @@ | ||
//// [tests/cases/compiler/declarationEmitPreserveReferencedImports.ts] //// | ||
|
||
=== utils.ts === | ||
|
||
export interface Evt { } | ||
|
||
|
||
=== decl.ts === | ||
import {Evt} from './utils' | ||
>Evt : any | ||
> : ^^^ | ||
|
||
export const o = <T>(o: T) => () : T => null! | ||
>o : <T>(o: T) => () => T | ||
> : ^ ^^ ^^ ^^^^^^^^^^^ | ||
><T>(o: T) => () : T => null! : <T>(o: T) => () => T | ||
> : ^ ^^ ^^ ^^^^^^^^^^^ | ||
>o : T | ||
> : ^ | ||
>() : T => null! : () => T | ||
> : ^^^^^^ | ||
>null! : never | ||
> : ^^^^^ | ||
|
||
=== main.ts === | ||
import { o } from './decl' | ||
>o : <T>(o: T) => () => T | ||
> : ^ ^^ ^^ ^^^^^^^^^^^ | ||
|
||
import { Evt } from './utils' | ||
>Evt : any | ||
> : ^^^ | ||
|
||
export const f = { o: o({ v: null! as Evt}) }; | ||
>f : { o: () => { v: Evt; }; } | ||
> : ^^^^^^^^^^^^^^^^ ^^^^^^ | ||
>{ o: o({ v: null! as Evt}) } : { o: () => { v: Evt; }; } | ||
> : ^^^^^^^^^^^^^^^^ ^^^^^^ | ||
>o : () => { v: Evt; } | ||
> : ^^^^^^^^^^^ ^^^ | ||
>o({ v: null! as Evt}) : () => { v: Evt; } | ||
> : ^^^^^^^^^^^ ^^^ | ||
>o : <T>(o: T) => () => T | ||
> : ^ ^^ ^^ ^^^^^^^^^^^ | ||
>{ v: null! as Evt} : { v: Evt; } | ||
> : ^^^^^ ^^^ | ||
>v : Evt | ||
> : ^^^ | ||
>null! as Evt : Evt | ||
> : ^^^ | ||
>null! : never | ||
> : ^^^^^ | ||
|
16 changes: 16 additions & 0 deletions
16
tests/cases/compiler/declarationEmitPreserveReferencedImports.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,16 @@ | ||
// @declaration: true | ||
// @strict: true | ||
|
||
// @filename: utils.ts | ||
export interface Evt { } | ||
|
||
|
||
// @filename: decl.ts | ||
import {Evt} from './utils' | ||
export const o = <T>(o: T) => () : T => null! | ||
|
||
// @filename: main.ts | ||
import { o } from './decl' | ||
import { Evt } from './utils' | ||
|
||
export const f = { o: o({ v: null! as Evt}) }; |