Skip to content

Add test for fixed declaration emit type parameter leak #58208

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions tests/baselines/reference/declarationEmitNoTypeParamLeak1.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
//// [tests/cases/compiler/declarationEmitNoTypeParamLeak1.ts] ////

//// [declarationEmitNoTypeParamLeak1.ts]
type BrokenType<T> = 'a' | 'b';

class MyClass {
constructor(readonly arg?: BrokenType<any>) {}
}

//// [declarationEmitNoTypeParamLeak1.js]
"use strict";
var MyClass = /** @class */ (function () {
function MyClass(arg) {
this.arg = arg;
}
return MyClass;
}());


//// [declarationEmitNoTypeParamLeak1.d.ts]
type BrokenType<T> = 'a' | 'b';
declare class MyClass {
readonly arg?: BrokenType<any> | undefined;
constructor(arg?: BrokenType<any> | undefined);
}
14 changes: 14 additions & 0 deletions tests/baselines/reference/declarationEmitNoTypeParamLeak1.symbols
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//// [tests/cases/compiler/declarationEmitNoTypeParamLeak1.ts] ////

=== declarationEmitNoTypeParamLeak1.ts ===
type BrokenType<T> = 'a' | 'b';
>BrokenType : Symbol(BrokenType, Decl(declarationEmitNoTypeParamLeak1.ts, 0, 0))
>T : Symbol(T, Decl(declarationEmitNoTypeParamLeak1.ts, 0, 16))

class MyClass {
>MyClass : Symbol(MyClass, Decl(declarationEmitNoTypeParamLeak1.ts, 0, 31))

constructor(readonly arg?: BrokenType<any>) {}
>arg : Symbol(MyClass.arg, Decl(declarationEmitNoTypeParamLeak1.ts, 3, 16))
>BrokenType : Symbol(BrokenType, Decl(declarationEmitNoTypeParamLeak1.ts, 0, 0))
}
15 changes: 15 additions & 0 deletions tests/baselines/reference/declarationEmitNoTypeParamLeak1.types
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//// [tests/cases/compiler/declarationEmitNoTypeParamLeak1.ts] ////

=== declarationEmitNoTypeParamLeak1.ts ===
type BrokenType<T> = 'a' | 'b';
>BrokenType : BrokenType<T>
> : ^^^^^^^^^^^^^

class MyClass {
>MyClass : MyClass
> : ^^^^^^^

constructor(readonly arg?: BrokenType<any>) {}
>arg : BrokenType<T> | undefined
> : ^^^^^^^^^^^^^^^^^^^^^^^^^
}
8 changes: 8 additions & 0 deletions tests/cases/compiler/declarationEmitNoTypeParamLeak1.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// @strict: true
// @declaration: true

type BrokenType<T> = 'a' | 'b';

class MyClass {
constructor(readonly arg?: BrokenType<any>) {}
}