Skip to content

Commit d8caed4

Browse files
committed
Add new test case which breaks with this code
1 parent ae91031 commit d8caed4

File tree

4 files changed

+72
-0
lines changed

4 files changed

+72
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
//// [tests/cases/compiler/declarationEmitTypeParameterNameShadowedInternally.ts] ////
2+
3+
//// [declarationEmitTypeParameterNameShadowedInternally.ts]
4+
export const foo = <T,>(x: T) => {
5+
const inner = <T,>(y: T) => [x, y] as const;
6+
return inner;
7+
}
8+
9+
10+
//// [declarationEmitTypeParameterNameShadowedInternally.js]
11+
"use strict";
12+
Object.defineProperty(exports, "__esModule", { value: true });
13+
exports.foo = void 0;
14+
var foo = function (x) {
15+
var inner = function (y) { return [x, y]; };
16+
return inner;
17+
};
18+
exports.foo = foo;
19+
20+
21+
//// [declarationEmitTypeParameterNameShadowedInternally.d.ts]
22+
export declare const foo: <T>(x: T) => <T_1>(y: T_1) => readonly [T, T_1];
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
//// [tests/cases/compiler/declarationEmitTypeParameterNameShadowedInternally.ts] ////
2+
3+
=== declarationEmitTypeParameterNameShadowedInternally.ts ===
4+
export const foo = <T,>(x: T) => {
5+
>foo : Symbol(foo, Decl(declarationEmitTypeParameterNameShadowedInternally.ts, 0, 12))
6+
>T : Symbol(T, Decl(declarationEmitTypeParameterNameShadowedInternally.ts, 0, 20))
7+
>x : Symbol(x, Decl(declarationEmitTypeParameterNameShadowedInternally.ts, 0, 24))
8+
>T : Symbol(T, Decl(declarationEmitTypeParameterNameShadowedInternally.ts, 0, 20))
9+
10+
const inner = <T,>(y: T) => [x, y] as const;
11+
>inner : Symbol(inner, Decl(declarationEmitTypeParameterNameShadowedInternally.ts, 1, 6))
12+
>T : Symbol(T, Decl(declarationEmitTypeParameterNameShadowedInternally.ts, 1, 16))
13+
>y : Symbol(y, Decl(declarationEmitTypeParameterNameShadowedInternally.ts, 1, 20))
14+
>T : Symbol(T, Decl(declarationEmitTypeParameterNameShadowedInternally.ts, 1, 16))
15+
>x : Symbol(x, Decl(declarationEmitTypeParameterNameShadowedInternally.ts, 0, 24))
16+
>y : Symbol(y, Decl(declarationEmitTypeParameterNameShadowedInternally.ts, 1, 20))
17+
>const : Symbol(const)
18+
19+
return inner;
20+
>inner : Symbol(inner, Decl(declarationEmitTypeParameterNameShadowedInternally.ts, 1, 6))
21+
}
22+
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
//// [tests/cases/compiler/declarationEmitTypeParameterNameShadowedInternally.ts] ////
2+
3+
=== declarationEmitTypeParameterNameShadowedInternally.ts ===
4+
export const foo = <T,>(x: T) => {
5+
>foo : <T>(x: T) => <T_1>(y: T_1) => readonly [T, T_1]
6+
><T,>(x: T) => { const inner = <T,>(y: T) => [x, y] as const; return inner;} : <T>(x: T) => <T_1>(y: T_1) => readonly [T, T_1]
7+
>x : T
8+
9+
const inner = <T,>(y: T) => [x, y] as const;
10+
>inner : <T_1>(y: T_1) => readonly [T, T_1]
11+
><T,>(y: T) => [x, y] as const : <T_1>(y: T_1) => readonly [T, T_1]
12+
>y : T
13+
>[x, y] as const : readonly [T_1, T]
14+
>[x, y] : readonly [T_1, T]
15+
>x : T_1
16+
>y : T
17+
18+
return inner;
19+
>inner : <T_1>(y: T_1) => readonly [T, T_1]
20+
}
21+
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// @declaration: true
2+
// @skipLibCheck: false
3+
4+
export const foo = <T,>(x: T) => {
5+
const inner = <T,>(y: T) => [x, y] as const;
6+
return inner;
7+
}

0 commit comments

Comments
 (0)