Skip to content

Commit 5fb8ebb

Browse files
jakebaileyweswigham
andcommitted
Add test case from PR 56046
Co-authored-by: Wesley Wigham <[email protected]>
1 parent 5460495 commit 5fb8ebb

4 files changed

+100
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
//// [tests/cases/compiler/declarationEmitReusesLambdaParameterNodes.ts] ////
2+
3+
//// [index.d.ts]
4+
export type Whatever = {x: string, y: number};
5+
export type Props<T, TThing = Whatever> = Omit<TThing, "y"> & Partial<TThing> & T;
6+
7+
//// [index.ts]
8+
import { Props } from "react-select";
9+
10+
export const CustomSelect1 = <Option,>(x: Props<Option> & {}) => {}
11+
export function CustomSelect2<Option,>(x: Props<Option> & {}) {}
12+
13+
14+
//// [index.js]
15+
"use strict";
16+
Object.defineProperty(exports, "__esModule", { value: true });
17+
exports.CustomSelect2 = exports.CustomSelect1 = void 0;
18+
var CustomSelect1 = function (x) { };
19+
exports.CustomSelect1 = CustomSelect1;
20+
function CustomSelect2(x) { }
21+
exports.CustomSelect2 = CustomSelect2;
22+
23+
24+
//// [index.d.ts]
25+
import { Props } from "react-select";
26+
export declare const CustomSelect1: <Option>(x: Props<Option> & {}) => void;
27+
export declare function CustomSelect2<Option>(x: Props<Option> & {}): void;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
//// [tests/cases/compiler/declarationEmitReusesLambdaParameterNodes.ts] ////
2+
3+
=== node_modules/react-select/index.d.ts ===
4+
export type Whatever = {x: string, y: number};
5+
>Whatever : Symbol(Whatever, Decl(index.d.ts, 0, 0))
6+
>x : Symbol(x, Decl(index.d.ts, 0, 24))
7+
>y : Symbol(y, Decl(index.d.ts, 0, 34))
8+
9+
export type Props<T, TThing = Whatever> = Omit<TThing, "y"> & Partial<TThing> & T;
10+
>Props : Symbol(Props, Decl(index.d.ts, 0, 46))
11+
>T : Symbol(T, Decl(index.d.ts, 1, 18))
12+
>TThing : Symbol(TThing, Decl(index.d.ts, 1, 20))
13+
>Whatever : Symbol(Whatever, Decl(index.d.ts, 0, 0))
14+
>Omit : Symbol(Omit, Decl(lib.es5.d.ts, --, --))
15+
>TThing : Symbol(TThing, Decl(index.d.ts, 1, 20))
16+
>Partial : Symbol(Partial, Decl(lib.es5.d.ts, --, --))
17+
>TThing : Symbol(TThing, Decl(index.d.ts, 1, 20))
18+
>T : Symbol(T, Decl(index.d.ts, 1, 18))
19+
20+
=== index.ts ===
21+
import { Props } from "react-select";
22+
>Props : Symbol(Props, Decl(index.ts, 0, 8))
23+
24+
export const CustomSelect1 = <Option,>(x: Props<Option> & {}) => {}
25+
>CustomSelect1 : Symbol(CustomSelect1, Decl(index.ts, 2, 12))
26+
>Option : Symbol(Option, Decl(index.ts, 2, 30))
27+
>x : Symbol(x, Decl(index.ts, 2, 39))
28+
>Props : Symbol(Props, Decl(index.ts, 0, 8))
29+
>Option : Symbol(Option, Decl(index.ts, 2, 30))
30+
31+
export function CustomSelect2<Option,>(x: Props<Option> & {}) {}
32+
>CustomSelect2 : Symbol(CustomSelect2, Decl(index.ts, 2, 67))
33+
>Option : Symbol(Option, Decl(index.ts, 3, 30))
34+
>x : Symbol(x, Decl(index.ts, 3, 39))
35+
>Props : Symbol(Props, Decl(index.ts, 0, 8))
36+
>Option : Symbol(Option, Decl(index.ts, 3, 30))
37+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
//// [tests/cases/compiler/declarationEmitReusesLambdaParameterNodes.ts] ////
2+
3+
=== node_modules/react-select/index.d.ts ===
4+
export type Whatever = {x: string, y: number};
5+
>Whatever : { x: string; y: number; }
6+
>x : string
7+
>y : number
8+
9+
export type Props<T, TThing = Whatever> = Omit<TThing, "y"> & Partial<TThing> & T;
10+
>Props : Props<T, TThing>
11+
12+
=== index.ts ===
13+
import { Props } from "react-select";
14+
>Props : any
15+
16+
export const CustomSelect1 = <Option,>(x: Props<Option> & {}) => {}
17+
>CustomSelect1 : <Option>(x: Omit<import("node_modules/react-select/index").Whatever, "y"> & Partial<import("node_modules/react-select/index").Whatever> & Option) => void
18+
><Option,>(x: Props<Option> & {}) => {} : <Option>(x: Omit<import("node_modules/react-select/index").Whatever, "y"> & Partial<import("node_modules/react-select/index").Whatever> & Option) => void
19+
>x : Omit<import("node_modules/react-select/index").Whatever, "y"> & Partial<import("node_modules/react-select/index").Whatever> & Option
20+
21+
export function CustomSelect2<Option,>(x: Props<Option> & {}) {}
22+
>CustomSelect2 : <Option>(x: Props<Option> & {}) => void
23+
>x : Omit<import("node_modules/react-select/index").Whatever, "y"> & Partial<import("node_modules/react-select/index").Whatever> & Option
24+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// @strict: true
2+
// @declaration: true
3+
// @module: nodenext
4+
// @filename: node_modules/react-select/index.d.ts
5+
export type Whatever = {x: string, y: number};
6+
export type Props<T, TThing = Whatever> = Omit<TThing, "y"> & Partial<TThing> & T;
7+
8+
// @filename: index.ts
9+
import { Props } from "react-select";
10+
11+
export const CustomSelect1 = <Option,>(x: Props<Option> & {}) => {}
12+
export function CustomSelect2<Option,>(x: Props<Option> & {}) {}

0 commit comments

Comments
 (0)