TypeScript/tests/cases/fourslash/tsxQuickInfo6.ts
2017-12-15 10:02:56 -08:00

19 lines
802 B
TypeScript

/// <reference path='fourslash.ts' />
//@Filename: file.tsx
// @jsx: preserve
// @noLib: true
//// declare function ComponentSpecific<U>(l: {prop: U}): JSX.Element;
//// declare function ComponentSpecific1<U>(l: {prop: U, "ignore-prop": number}): JSX.Element;
//// function Bar<T extends {prop: number}>(arg: T) {
//// let a1 = <Compone/*1*/ntSpecific {...arg} ignore-prop="hi" />; // U is number
//// let a2 = <ComponentSpecific1 {...arg} ignore-prop={10} />; // U is number
//// let a3 = <Component/*2*/Specific {...arg} prop="hello" />; // U is "hello"
//// }
verify.quickInfos({
1: "function ComponentSpecific<number>(l: {\n prop: number;\n}): any",
2: "function ComponentSpecific<number & string>(l: {\n prop: number & string;\n}): any"
});