diff --git a/src/lib/dom.generated.d.ts b/src/lib/dom.generated.d.ts index 65f329b3398b5..6d45ab520dc46 100644 --- a/src/lib/dom.generated.d.ts +++ b/src/lib/dom.generated.d.ts @@ -31943,12 +31943,6 @@ declare var StorageManager: { new(): StorageManager; }; -/** @deprecated */ -interface StyleMedia { - type: string; - matchMedium(mediaquery: string): boolean; -} - /** * The **`StylePropertyMap`** interface of the CSS Typed Object Model API provides a representation of a CSS declaration block that is an alternative to CSSStyleDeclaration. * diff --git a/tests/baselines/reference/callsOnComplexSignatures.types b/tests/baselines/reference/callsOnComplexSignatures.types index a9a9805eb5554..3d79b626262d9 100644 --- a/tests/baselines/reference/callsOnComplexSignatures.types +++ b/tests/baselines/reference/callsOnComplexSignatures.types @@ -663,9 +663,11 @@ function test5() { c?: any; >c : any +> : ^^^ d?: any; >d : any +> : ^^^ } var C: React.ComponentType | React.ComponentType = null as any; @@ -676,6 +678,7 @@ function test5() { >React : any > : ^^^ >null as any : any +> : ^^^ const a = ; >a : JSX.Element diff --git a/tests/baselines/reference/checkJsxChildrenCanBeTupleType.errors.txt b/tests/baselines/reference/checkJsxChildrenCanBeTupleType.errors.txt deleted file mode 100644 index cc60334c1e39b..0000000000000 --- a/tests/baselines/reference/checkJsxChildrenCanBeTupleType.errors.txt +++ /dev/null @@ -1,47 +0,0 @@ -checkJsxChildrenCanBeTupleType.tsx(17,18): error TS2769: No overload matches this call. - Overload 1 of 2, '(props: Readonly): ResizablePanel', gave the following error. - Type '{ children: [Element, Element, Element]; }' is not assignable to type 'Readonly'. - Types of property 'children' are incompatible. - Type '[Element, Element, Element]' is not assignable to type '[ReactNode, ReactNode]'. - Source has 3 element(s) but target allows only 2. - Overload 2 of 2, '(props: ResizablePanelProps, context?: any): ResizablePanel', gave the following error. - Type '{ children: [Element, Element, Element]; }' is not assignable to type 'Readonly'. - Types of property 'children' are incompatible. - Type '[Element, Element, Element]' is not assignable to type '[ReactNode, ReactNode]'. - Source has 3 element(s) but target allows only 2. - - -==== checkJsxChildrenCanBeTupleType.tsx (1 errors) ==== - /// - - import React from 'react' - - interface ResizablePanelProps { - children: [React.ReactNode, React.ReactNode] - } - - class ResizablePanel extends React.Component< - ResizablePanelProps, any> {} - - const test = -
-
- - - const testErr = - ~~~~~~~~~~~~~~ -!!! error TS2769: No overload matches this call. -!!! error TS2769: Overload 1 of 2, '(props: Readonly): ResizablePanel', gave the following error. -!!! error TS2769: Type '{ children: [Element, Element, Element]; }' is not assignable to type 'Readonly'. -!!! error TS2769: Types of property 'children' are incompatible. -!!! error TS2769: Type '[Element, Element, Element]' is not assignable to type '[ReactNode, ReactNode]'. -!!! error TS2769: Source has 3 element(s) but target allows only 2. -!!! error TS2769: Overload 2 of 2, '(props: ResizablePanelProps, context?: any): ResizablePanel', gave the following error. -!!! error TS2769: Type '{ children: [Element, Element, Element]; }' is not assignable to type 'Readonly'. -!!! error TS2769: Types of property 'children' are incompatible. -!!! error TS2769: Type '[Element, Element, Element]' is not assignable to type '[ReactNode, ReactNode]'. -!!! error TS2769: Source has 3 element(s) but target allows only 2. -
-
-
- \ No newline at end of file diff --git a/tests/baselines/reference/controlFlowOptionalChain3.errors.txt b/tests/baselines/reference/controlFlowOptionalChain3.errors.txt deleted file mode 100644 index 15a8997f0376e..0000000000000 --- a/tests/baselines/reference/controlFlowOptionalChain3.errors.txt +++ /dev/null @@ -1,49 +0,0 @@ -controlFlowOptionalChain3.tsx(30,8): error TS18048: 'foo' is possibly 'undefined'. -controlFlowOptionalChain3.tsx(36,31): error TS18048: 'options' is possibly 'undefined'. - - -==== controlFlowOptionalChain3.tsx (2 errors) ==== - /// - - // https://github.com/microsoft/TypeScript/issues/56482 - - import React from "react"; - - interface Foo { - bar: boolean; - } - - function test1(foo: Foo | undefined) { - if (foo?.bar === false) { - foo; - } - foo; - } - - function test2(foo: Foo | undefined) { - if (foo?.bar === false) { - foo; - } else { - foo; - } - } - - function Test3({ foo }: { foo: Foo | undefined }) { - return ( -
- {foo?.bar === false && "foo"} - {foo.bar ? "true" : "false"} - ~~~ -!!! error TS18048: 'foo' is possibly 'undefined'. -
- ); - } - - function test4(options?: { a?: boolean; b?: boolean }) { - if (options?.a === false || options.b) { - ~~~~~~~ -!!! error TS18048: 'options' is possibly 'undefined'. - options; - } - } - \ No newline at end of file diff --git a/tests/baselines/reference/errorInfoForRelatedIndexTypesNoConstraintElaboration.errors.txt b/tests/baselines/reference/errorInfoForRelatedIndexTypesNoConstraintElaboration.errors.txt deleted file mode 100644 index 8bb0c0a5ef3a8..0000000000000 --- a/tests/baselines/reference/errorInfoForRelatedIndexTypesNoConstraintElaboration.errors.txt +++ /dev/null @@ -1,18 +0,0 @@ -errorInfoForRelatedIndexTypesNoConstraintElaboration.ts(6,15): error TS2322: Type 'IntrinsicElements[T1]' is not assignable to type 'IntrinsicElements[T2]'. - Type 'T1' is not assignable to type 'T2'. - 'T1' is assignable to the constraint of type 'T2', but 'T2' could be instantiated with a different subtype of constraint 'keyof IntrinsicElements'. - - -==== errorInfoForRelatedIndexTypesNoConstraintElaboration.ts (1 errors) ==== - /// - - class I { - M() { - let c1: JSX.IntrinsicElements[T1] = {}; - const c2: JSX.IntrinsicElements[T2] = c1; - ~~ -!!! error TS2322: Type 'IntrinsicElements[T1]' is not assignable to type 'IntrinsicElements[T2]'. -!!! error TS2322: Type 'T1' is not assignable to type 'T2'. -!!! error TS2322: 'T1' is assignable to the constraint of type 'T2', but 'T2' could be instantiated with a different subtype of constraint 'keyof IntrinsicElements'. - } - } \ No newline at end of file diff --git a/tests/baselines/reference/ignoredJsxAttributes.errors.txt b/tests/baselines/reference/ignoredJsxAttributes.errors.txt deleted file mode 100644 index 0fcfd8cfb2702..0000000000000 --- a/tests/baselines/reference/ignoredJsxAttributes.errors.txt +++ /dev/null @@ -1,32 +0,0 @@ -ignoredJsxAttributes.tsx(16,5): error TS2322: Type 'number' is not assignable to type 'string'. -ignoredJsxAttributes.tsx(20,11): error TS2741: Property 'foo' is missing in type '{ bar: string; "data-yadda": number; }' but required in type 'Props'. - - -==== ignoredJsxAttributes.tsx (2 errors) ==== - /// - - // Repro from #44797 - - import * as React from "react"; - - interface Props { - foo: string; - [dataProp: string]: string; - } - - declare function Yadda(props: Props): JSX.Element; - - let props: Props = { - foo: "", - "data-yadda": 42, // Error - ~~~~~~~~~~~~ -!!! error TS2322: Type 'number' is not assignable to type 'string'. -!!! related TS6501 ignoredJsxAttributes.tsx:9:5: The expected type comes from this index signature. - }; - - let x1 = ; - let x2 = ; // Error - ~~~~~ -!!! error TS2741: Property 'foo' is missing in type '{ bar: string; "data-yadda": number; }' but required in type 'Props'. -!!! related TS2728 ignoredJsxAttributes.tsx:8:5: 'foo' is declared here. - \ No newline at end of file diff --git a/tests/baselines/reference/jsDeclarationsNonIdentifierInferredNames.js b/tests/baselines/reference/jsDeclarationsNonIdentifierInferredNames.js index 126e019e73967..8d8bea0fa8c02 100644 --- a/tests/baselines/reference/jsDeclarationsNonIdentifierInferredNames.js +++ b/tests/baselines/reference/jsDeclarationsNonIdentifierInferredNames.js @@ -22,21 +22,3 @@ export function ExampleFunctionalComponent({ "data-testid": dataTestId, [dynProp }): JSX.Element; declare const dynPropName: "data-dyn"; export {}; - - -//// [DtsFileErrors] - - -out/jsDeclarationsNonIdentifierInferredNames.d.ts(4,5): error TS2503: Cannot find namespace 'JSX'. - - -==== out/jsDeclarationsNonIdentifierInferredNames.d.ts (1 errors) ==== - export function ExampleFunctionalComponent({ "data-testid": dataTestId, [dynPropName]: dynProp }: { - "data-testid": any; - "data-dyn": any; - }): JSX.Element; - ~~~ -!!! error TS2503: Cannot find namespace 'JSX'. - declare const dynPropName: "data-dyn"; - export {}; - \ No newline at end of file diff --git a/tests/baselines/reference/jsxCallElaborationCheckNoCrash1.errors.txt b/tests/baselines/reference/jsxCallElaborationCheckNoCrash1.errors.txt deleted file mode 100644 index d4845877f3d9c..0000000000000 --- a/tests/baselines/reference/jsxCallElaborationCheckNoCrash1.errors.txt +++ /dev/null @@ -1,19 +0,0 @@ -jsxCallElaborationCheckNoCrash1.tsx(10,29): error TS2322: Type '{}' is not assignable to type 'LibraryManagedAttributes, HTMLDivElement>>'. - - -==== jsxCallElaborationCheckNoCrash1.tsx (1 errors) ==== - /// - - import * as React from "react"; - - type Tags = "span" | "div"; - - export const Hoc = ( - TagElement: Tag, - ): React.SFC => { - const Component = () => ; - ~~~~~~~~~~ -!!! error TS2322: Type '{}' is not assignable to type 'LibraryManagedAttributes, HTMLDivElement>>'. - return Component; - }; - \ No newline at end of file diff --git a/tests/baselines/reference/jsxChildrenIndividualErrorElaborations.errors.txt b/tests/baselines/reference/jsxChildrenIndividualErrorElaborations.errors.txt deleted file mode 100644 index 56914523104d5..0000000000000 --- a/tests/baselines/reference/jsxChildrenIndividualErrorElaborations.errors.txt +++ /dev/null @@ -1,131 +0,0 @@ -index.tsx(14,9): error TS2322: Type 'number' is not assignable to type 'string'. -index.tsx(18,15): error TS2747: 'Blah' components don't accept text as child elements. Text in JSX has the type 'string', but the expected type of 'children' is '(x: number) => string'. -index.tsx(23,10): error TS2746: This JSX tag's 'children' prop expects a single child of type '(x: number) => string', but multiple children were provided. -index.tsx(37,10): error TS2745: This JSX tag's 'children' prop expects type '((x: number) => string)[]' which requires multiple children, but only a single child was provided. -index.tsx(38,4): error TS7006: Parameter 'x' implicitly has an 'any' type. -index.tsx(42,10): error TS2745: This JSX tag's 'children' prop expects type '((x: number) => string)[]' which requires multiple children, but only a single child was provided. -index.tsx(48,9): error TS2322: Type 'number' is not assignable to type 'string'. -index.tsx(49,9): error TS2322: Type 'number' is not assignable to type 'string'. -index.tsx(63,3): error TS2322: Type '(x: number) => number' is not assignable to type 'Cb | Cb[]'. - Type '(x: number) => number' is not assignable to type 'Cb'. - Type 'number' is not assignable to type 'string'. -index.tsx(67,16): error TS2747: 'Blah3' components don't accept text as child elements. Text in JSX has the type 'string', but the expected type of 'children' is 'Cb | Cb[]'. -index.tsx(73,9): error TS2322: Type 'number' is not assignable to type 'string'. -index.tsx(74,9): error TS2322: Type 'number' is not assignable to type 'string'. - - -==== index.tsx (12 errors) ==== - /// - import * as React from "react"; - - interface Props { - children: (x: number) => string; - } - - export function Blah(props: Props) { - return <>; - } - - // Incompatible child. - var a = - {x => x} - ~ -!!! error TS2322: Type 'number' is not assignable to type 'string'. -!!! related TS6502 index.tsx:5:13: The expected type comes from the return type of this signature. - - - // Blah components don't accept text as child elements - var a = - - Hello unexpected text! - ~~~~~~~~~~~~~~~~~~~~~~~~ - - -!!! error TS2747: 'Blah' components don't accept text as child elements. Text in JSX has the type 'string', but the expected type of 'children' is '(x: number) => string'. -!!! related TS6500 index.tsx:5:3: The expected type comes from property 'children' which is declared here on type 'IntrinsicAttributes & Props' - - // Blah components don't accept multiple children. - var a = - ~~~~ -!!! error TS2746: This JSX tag's 'children' prop expects a single child of type '(x: number) => string', but multiple children were provided. - {x => "" + x} - {x => "" + x} - - - interface PropsArr { - children: ((x: number) => string)[]; - } - - export function Blah2(props: PropsArr) { - return <>; - } - - // Incompatible child. - var a = - ~~~~~ -!!! error TS2745: This JSX tag's 'children' prop expects type '((x: number) => string)[]' which requires multiple children, but only a single child was provided. - {x => x} - ~ -!!! error TS7006: Parameter 'x' implicitly has an 'any' type. - - - // Blah2 components don't accept text as child elements - var a = - ~~~~~ -!!! error TS2745: This JSX tag's 'children' prop expects type '((x: number) => string)[]' which requires multiple children, but only a single child was provided. - Hello unexpected text! - - - // Blah2 components don't accept multiple children of the wrong type. - var a = - {x => x} - ~ -!!! error TS2322: Type 'number' is not assignable to type 'string'. -!!! related TS6502 index.tsx:29:14: The expected type comes from the return type of this signature. - {x => x} - ~ -!!! error TS2322: Type 'number' is not assignable to type 'string'. -!!! related TS6502 index.tsx:29:14: The expected type comes from the return type of this signature. - - - type Cb = (x: number) => string; - interface PropsMixed { - children: Cb | Cb[]; - } - - export function Blah3(props: PropsMixed) { - return <>; - } - - // Incompatible child. - var a = - {x => x} - ~~~~~~~~ -!!! error TS2322: Type '(x: number) => number' is not assignable to type 'Cb | Cb[]'. -!!! error TS2322: Type '(x: number) => number' is not assignable to type 'Cb'. -!!! error TS2322: Type 'number' is not assignable to type 'string'. -!!! related TS6500 index.tsx:54:3: The expected type comes from property 'children' which is declared here on type 'IntrinsicAttributes & PropsMixed' - - - // Blah3 components don't accept text as child elements - var a = - - Hello unexpected text! - ~~~~~~~~~~~~~~~~~~~~~~~~ - - -!!! error TS2747: 'Blah3' components don't accept text as child elements. Text in JSX has the type 'string', but the expected type of 'children' is 'Cb | Cb[]'. -!!! related TS6500 index.tsx:54:3: The expected type comes from property 'children' which is declared here on type 'IntrinsicAttributes & PropsMixed' - - // Blah3 components don't accept multiple children of the wrong type. - var a = - {x => x} - ~ -!!! error TS2322: Type 'number' is not assignable to type 'string'. -!!! related TS6502 index.tsx:52:11: The expected type comes from the return type of this signature. - {x => x} - ~ -!!! error TS2322: Type 'number' is not assignable to type 'string'. -!!! related TS6502 index.tsx:52:11: The expected type comes from the return type of this signature. - - \ No newline at end of file diff --git a/tests/baselines/reference/jsxDeclarationsWithEsModuleInteropNoCrash.types b/tests/baselines/reference/jsxDeclarationsWithEsModuleInteropNoCrash.types index 812d3c7a3d3c3..f56304e1d9ab5 100644 --- a/tests/baselines/reference/jsxDeclarationsWithEsModuleInteropNoCrash.types +++ b/tests/baselines/reference/jsxDeclarationsWithEsModuleInteropNoCrash.types @@ -60,6 +60,7 @@ function Foo({ bar }) { >div : any > : ^^^ >bar : any +> : ^^^ >div : any > : ^^^ } diff --git a/tests/baselines/reference/jsxElementType.errors.txt b/tests/baselines/reference/jsxElementType.errors.txt deleted file mode 100644 index 8922915105d64..0000000000000 --- a/tests/baselines/reference/jsxElementType.errors.txt +++ /dev/null @@ -1,222 +0,0 @@ -jsxElementType.tsx(34,2): error TS2741: Property 'title' is missing in type '{}' but required in type '{ title: string; }'. -jsxElementType.tsx(36,16): error TS2322: Type '{ excessProp: true; }' is not assignable to type 'IntrinsicAttributes & { title: string; }'. - Property 'excessProp' does not exist on type 'IntrinsicAttributes & { title: string; }'. -jsxElementType.tsx(40,2): error TS2741: Property 'title' is missing in type '{}' but required in type '{ title: string; }'. -jsxElementType.tsx(42,15): error TS2322: Type '{ excessProp: true; }' is not assignable to type 'IntrinsicAttributes & { title: string; }'. - Property 'excessProp' does not exist on type 'IntrinsicAttributes & { title: string; }'. -jsxElementType.tsx(46,2): error TS2741: Property 'title' is missing in type '{}' but required in type '{ title: string; }'. -jsxElementType.tsx(48,15): error TS2322: Type '{ excessProp: true; }' is not assignable to type 'IntrinsicAttributes & { title: string; }'. - Property 'excessProp' does not exist on type 'IntrinsicAttributes & { title: string; }'. -jsxElementType.tsx(52,2): error TS2741: Property 'title' is missing in type '{}' but required in type '{ title: string; }'. -jsxElementType.tsx(54,14): error TS2322: Type '{ excessProp: true; }' is not assignable to type 'IntrinsicAttributes & { title: string; }'. - Property 'excessProp' does not exist on type 'IntrinsicAttributes & { title: string; }'. -jsxElementType.tsx(59,2): error TS2741: Property 'title' is missing in type '{}' but required in type '{ title: string; }'. -jsxElementType.tsx(61,16): error TS2322: Type '{ excessProp: true; }' is not assignable to type 'IntrinsicAttributes & { title: string; }'. - Property 'excessProp' does not exist on type 'IntrinsicAttributes & { title: string; }'. -jsxElementType.tsx(70,2): error TS2769: No overload matches this call. - Overload 1 of 2, '(props: Readonly<{ title: string; }>): RenderStringClass', gave the following error. - Property 'title' is missing in type '{}' but required in type 'Readonly<{ title: string; }>'. - Overload 2 of 2, '(props: { title: string; }, context?: any): RenderStringClass', gave the following error. - Property 'title' is missing in type '{}' but required in type 'Readonly<{ title: string; }>'. -jsxElementType.tsx(72,20): error TS2769: No overload matches this call. - Overload 1 of 2, '(props: Readonly<{ title: string; }>): RenderStringClass', gave the following error. - Type '{ excessProp: true; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes & Readonly<{ children?: ReactNode; }> & Readonly<{ title: string; }>'. - Property 'excessProp' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes & Readonly<{ children?: ReactNode; }> & Readonly<{ title: string; }>'. - Overload 2 of 2, '(props: { title: string; }, context?: any): RenderStringClass', gave the following error. - Type '{ excessProp: true; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes & Readonly<{ children?: ReactNode; }> & Readonly<{ title: string; }>'. - Property 'excessProp' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes & Readonly<{ children?: ReactNode; }> & Readonly<{ title: string; }>'. -jsxElementType.tsx(78,1): error TS2339: Property 'boop' does not exist on type 'JSX.IntrinsicElements'. -jsxElementType.tsx(79,1): error TS2339: Property 'my-undeclared-custom-element' does not exist on type 'JSX.IntrinsicElements'. -jsxElementType.tsx(91,2): error TS2786: 'ReactNativeFlatList' cannot be used as a JSX component. - Its type '(props: {}, ref: ForwardedRef) => null' is not a valid JSX element type. - Type '(props: {}, ref: ForwardedRef) => null' is not assignable to type '(props: any) => React18ReactNode'. - Target signature provides too few arguments. Expected 2 or more, but got 1. -jsxElementType.tsx(95,11): error TS2322: Type '{}' is not assignable to type 'LibraryManagedAttributes'. -jsxElementType.tsx(98,2): error TS2304: Cannot find name 'Unresolved'. -jsxElementType.tsx(99,2): error TS2304: Cannot find name 'Unresolved'. -jsxElementType.tsx(110,6): error TS2322: Type '{ b: string; }' is not assignable to type '{ a: string; }'. - Property 'b' does not exist on type '{ a: string; }'. -jsxElementType.tsx(111,19): error TS2322: Type '{ a: string; b: string; }' is not assignable to type '{ a: string; }'. - Property 'b' does not exist on type '{ a: string; }'. - - -==== jsxElementType.tsx (20 errors) ==== - /// - import * as React from "react"; - - type React18ReactFragment = ReadonlyArray; - type React18ReactNode = - | React.ReactElement - | string - | number - | React18ReactFragment - | React.ReactPortal - | boolean - | null - | undefined - | Promise; - - // // React.JSXElementConstructor but it now can return React nodes from function components. - type NewReactJSXElementConstructor

= - | ((props: P) => React18ReactNode) - | (new (props: P) => React.Component); - - declare global { - namespace JSX { - type ElementType = string | NewReactJSXElementConstructor; - interface IntrinsicElements { - ['my-custom-element']: React.DOMAttributes; - } - } - } - - let Component: NewReactJSXElementConstructor<{ title: string }>; - - const RenderElement = ({ title }: { title: string }) =>

{title}
; - Component = RenderElement; - ; - ~~~~~~~~~~~~~ -!!! error TS2741: Property 'title' is missing in type '{}' but required in type '{ title: string; }'. -!!! related TS2728 jsxElementType.tsx:32:37: 'title' is declared here. - ; - ; - ~~~~~~~~~~ -!!! error TS2322: Type '{ excessProp: true; }' is not assignable to type 'IntrinsicAttributes & { title: string; }'. -!!! error TS2322: Property 'excessProp' does not exist on type 'IntrinsicAttributes & { title: string; }'. - - const RenderString = ({ title }: { title: string }) => title; - Component = RenderString; - ; - ~~~~~~~~~~~~ -!!! error TS2741: Property 'title' is missing in type '{}' but required in type '{ title: string; }'. -!!! related TS2728 jsxElementType.tsx:38:36: 'title' is declared here. - ; - ; - ~~~~~~~~~~ -!!! error TS2322: Type '{ excessProp: true; }' is not assignable to type 'IntrinsicAttributes & { title: string; }'. -!!! error TS2322: Property 'excessProp' does not exist on type 'IntrinsicAttributes & { title: string; }'. - - const RenderNumber = ({ title }: { title: string }) => title.length; - Component = RenderNumber; - ; - ~~~~~~~~~~~~ -!!! error TS2741: Property 'title' is missing in type '{}' but required in type '{ title: string; }'. -!!! related TS2728 jsxElementType.tsx:44:36: 'title' is declared here. - ; - ; - ~~~~~~~~~~ -!!! error TS2322: Type '{ excessProp: true; }' is not assignable to type 'IntrinsicAttributes & { title: string; }'. -!!! error TS2322: Property 'excessProp' does not exist on type 'IntrinsicAttributes & { title: string; }'. - - const RenderArray = ({ title }: { title: string }) => [title]; - Component = RenderArray; - ; - ~~~~~~~~~~~ -!!! error TS2741: Property 'title' is missing in type '{}' but required in type '{ title: string; }'. -!!! related TS2728 jsxElementType.tsx:50:35: 'title' is declared here. - ; - ; - ~~~~~~~~~~ -!!! error TS2322: Type '{ excessProp: true; }' is not assignable to type 'IntrinsicAttributes & { title: string; }'. -!!! error TS2322: Property 'excessProp' does not exist on type 'IntrinsicAttributes & { title: string; }'. - - // React Server Component - const RenderPromise = async ({ title }: { title: string }) => "react"; - Component = RenderPromise; - ; - ~~~~~~~~~~~~~ -!!! error TS2741: Property 'title' is missing in type '{}' but required in type '{ title: string; }'. -!!! related TS2728 jsxElementType.tsx:57:43: 'title' is declared here. - ; - ; - ~~~~~~~~~~ -!!! error TS2322: Type '{ excessProp: true; }' is not assignable to type 'IntrinsicAttributes & { title: string; }'. -!!! error TS2322: Property 'excessProp' does not exist on type 'IntrinsicAttributes & { title: string; }'. - - // Class components still work - class RenderStringClass extends React.Component<{ title: string }> { - render() { - return this.props.title; - } - } - Component = RenderStringClass; - ; - ~~~~~~~~~~~~~~~~~ -!!! error TS2769: No overload matches this call. -!!! error TS2769: Overload 1 of 2, '(props: Readonly<{ title: string; }>): RenderStringClass', gave the following error. -!!! error TS2769: Property 'title' is missing in type '{}' but required in type 'Readonly<{ title: string; }>'. -!!! error TS2769: Overload 2 of 2, '(props: { title: string; }, context?: any): RenderStringClass', gave the following error. -!!! error TS2769: Property 'title' is missing in type '{}' but required in type 'Readonly<{ title: string; }>'. -!!! related TS2728 jsxElementType.tsx:64:51: 'title' is declared here. -!!! related TS2728 jsxElementType.tsx:64:51: 'title' is declared here. - ; - ; - ~~~~~~~~~~ -!!! error TS2769: No overload matches this call. -!!! error TS2769: Overload 1 of 2, '(props: Readonly<{ title: string; }>): RenderStringClass', gave the following error. -!!! error TS2769: Type '{ excessProp: true; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes & Readonly<{ children?: ReactNode; }> & Readonly<{ title: string; }>'. -!!! error TS2769: Property 'excessProp' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes & Readonly<{ children?: ReactNode; }> & Readonly<{ title: string; }>'. -!!! error TS2769: Overload 2 of 2, '(props: { title: string; }, context?: any): RenderStringClass', gave the following error. -!!! error TS2769: Type '{ excessProp: true; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes & Readonly<{ children?: ReactNode; }> & Readonly<{ title: string; }>'. -!!! error TS2769: Property 'excessProp' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes & Readonly<{ children?: ReactNode; }> & Readonly<{ title: string; }>'. - - // Host element types still work -
; - ; - // Undeclared host element types are still rejected - ; - ~~~~~~~~ -!!! error TS2339: Property 'boop' does not exist on type 'JSX.IntrinsicElements'. - ; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2339: Property 'my-undeclared-custom-element' does not exist on type 'JSX.IntrinsicElements'. - - // Highlighting various ecosystem compat issues - // react-native-gesture-handler - // https://github.com/software-mansion/react-native-gesture-handler/blob/79017e5e7cc2e82e6467851f870920ff836ee04f/src/components/GestureComponents.tsx#L139-L146 - interface ReactNativeFlatListProps {} - function ReactNativeFlatList( - props: {}, - ref: React.ForwardedRef - ) { - return null; - } - ; - ~~~~~~~~~~~~~~~~~~~ -!!! error TS2786: 'ReactNativeFlatList' cannot be used as a JSX component. -!!! error TS2786: Its type '(props: {}, ref: ForwardedRef) => null' is not a valid JSX element type. -!!! error TS2786: Type '(props: {}, ref: ForwardedRef) => null' is not assignable to type '(props: any) => React18ReactNode'. -!!! error TS2786: Target signature provides too few arguments. Expected 2 or more, but got 1. - - // testing higher-order component compat - function f1 React.ReactElement>(Component: T) { - return ; - ~~~~~~~~~ -!!! error TS2322: Type '{}' is not assignable to type 'LibraryManagedAttributes'. - } - - ; - ~~~~~~~~~~ -!!! error TS2304: Cannot find name 'Unresolved'. - ; - ~~~~~~~~~~ -!!! error TS2304: Cannot find name 'Unresolved'. - - declare global { - namespace JSX { - interface IntrinsicElements { - ['a:b']: { a: string }; - } - } - } - - ; - ; - ~ -!!! error TS2322: Type '{ b: string; }' is not assignable to type '{ a: string; }'. -!!! error TS2322: Property 'b' does not exist on type '{ a: string; }'. - ; - ~ -!!! error TS2322: Type '{ a: string; b: string; }' is not assignable to type '{ a: string; }'. -!!! error TS2322: Property 'b' does not exist on type '{ a: string; }'. - \ No newline at end of file diff --git a/tests/baselines/reference/jsxElementTypeLiteral.errors.txt b/tests/baselines/reference/jsxElementTypeLiteral.errors.txt deleted file mode 100644 index c3f67c28f65d8..0000000000000 --- a/tests/baselines/reference/jsxElementTypeLiteral.errors.txt +++ /dev/null @@ -1,37 +0,0 @@ -jsxElementTypeLiteral.tsx(16,10): error TS2786: 'span' cannot be used as a JSX component. - Its type '"span"' is not a valid JSX element type. -jsxElementTypeLiteral.tsx(20,9): error TS2339: Property 'ruhroh' does not exist on type 'JSX.IntrinsicElements'. -jsxElementTypeLiteral.tsx(20,10): error TS2786: 'ruhroh' cannot be used as a JSX component. - Its type '"ruhroh"' is not a valid JSX element type. - - -==== jsxElementTypeLiteral.tsx (3 errors) ==== - /// - import * as React from "react"; - - declare global { - namespace JSX { - // This should only use keys of JSX.IntrinsicElements. - // Diverging here to illustrate different error messages. - type ElementType = "div"; - } - } - - // should be fine - `ElementType` accepts `div` - let a =
; - - // should be an error - `ElementType` does not accept `span` - let b = ; - ~~~~ -!!! error TS2786: 'span' cannot be used as a JSX component. -!!! error TS2786: Its type '"span"' is not a valid JSX element type. - - // Should be an error. - // `ruhroh` is in neither `IntrinsicElements` nor `ElementType` - let c = ; - ~~~~~~~~~~ -!!! error TS2339: Property 'ruhroh' does not exist on type 'JSX.IntrinsicElements'. - ~~~~~~ -!!! error TS2786: 'ruhroh' cannot be used as a JSX component. -!!! error TS2786: Its type '"ruhroh"' is not a valid JSX element type. - \ No newline at end of file diff --git a/tests/baselines/reference/jsxElementTypeLiteralWithGeneric.errors.txt b/tests/baselines/reference/jsxElementTypeLiteralWithGeneric.errors.txt deleted file mode 100644 index 73b9465b83193..0000000000000 --- a/tests/baselines/reference/jsxElementTypeLiteralWithGeneric.errors.txt +++ /dev/null @@ -1,33 +0,0 @@ -jsxElementTypeLiteralWithGeneric.tsx(21,9): error TS2339: Property 'ruhroh' does not exist on type 'JSX.IntrinsicElements'. -jsxElementTypeLiteralWithGeneric.tsx(21,10): error TS2786: 'ruhroh' cannot be used as a JSX component. - Its type '"ruhroh"' is not a valid JSX element type. - - -==== jsxElementTypeLiteralWithGeneric.tsx (2 errors) ==== - /// - import * as React from "react"; - - declare global { - namespace JSX { - type ElementType

= - | { - [K in keyof JSX.IntrinsicElements]: P extends JSX.IntrinsicElements[K] - ? K - : never; - }[keyof JSX.IntrinsicElements] - | React.ComponentType

; - } - } - - // should be fine - `ElementType` accepts `div` - let a =

; - - // Should be an error. - // `ruhroh` is in neither `IntrinsicElements` nor `ElementType` - let c = ; - ~~~~~~~~~~ -!!! error TS2339: Property 'ruhroh' does not exist on type 'JSX.IntrinsicElements'. - ~~~~~~ -!!! error TS2786: 'ruhroh' cannot be used as a JSX component. -!!! error TS2786: Its type '"ruhroh"' is not a valid JSX element type. - \ No newline at end of file diff --git a/tests/baselines/reference/jsxExcessPropsAndAssignability.errors.txt b/tests/baselines/reference/jsxExcessPropsAndAssignability.errors.txt deleted file mode 100644 index d86e0534c645d..0000000000000 --- a/tests/baselines/reference/jsxExcessPropsAndAssignability.errors.txt +++ /dev/null @@ -1,30 +0,0 @@ -jsxExcessPropsAndAssignability.tsx(13,27): error TS2698: Spread types may only be created from object types. -jsxExcessPropsAndAssignability.tsx(14,6): error TS2322: Type 'ComposedComponentProps & { myProp: number; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes> & Readonly<{ children?: ReactNode; }> & Readonly'. - Type 'ComposedComponentProps & { myProp: number; }' is not assignable to type 'Readonly'. -jsxExcessPropsAndAssignability.tsx(14,27): error TS2698: Spread types may only be created from object types. - - -==== jsxExcessPropsAndAssignability.tsx (3 errors) ==== - /// - - import * as React from 'react'; - - const myHoc = ( - ComposedComponent: React.ComponentClass, - ) => { - type WrapperComponentProps = ComposedComponentProps & { myProp: string }; - const WrapperComponent: React.ComponentClass = null as any; - - const props: ComposedComponentProps = null as any; - - ; - ~~~~~ -!!! error TS2698: Spread types may only be created from object types. - ; - ~~~~~~~~~~~~~~~~ -!!! error TS2322: Type 'ComposedComponentProps & { myProp: number; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes> & Readonly<{ children?: ReactNode; }> & Readonly'. -!!! error TS2322: Type 'ComposedComponentProps & { myProp: number; }' is not assignable to type 'Readonly'. - ~~~~~ -!!! error TS2698: Spread types may only be created from object types. - }; - \ No newline at end of file diff --git a/tests/baselines/reference/jsxFragmentFactoryNoUnusedLocals.types b/tests/baselines/reference/jsxFragmentFactoryNoUnusedLocals.types index f0aa73c5b85da..3b2edd16791f1 100644 --- a/tests/baselines/reference/jsxFragmentFactoryNoUnusedLocals.types +++ b/tests/baselines/reference/jsxFragmentFactoryNoUnusedLocals.types @@ -37,6 +37,7 @@ export function Counter({ count = 0 }: CounterProps) { >setCnt : any > : ^^^ >null as any : any +> : ^^^ return <> ><>

{cnt}

: JSX.Element @@ -48,6 +49,7 @@ export function Counter({ count = 0 }: CounterProps) { >p : any > : ^^^ >cnt : any +> : ^^^ >p : any > : ^^^ @@ -61,12 +63,17 @@ export function Counter({ count = 0 }: CounterProps) { >() => setCnt((prev) => prev + 1) : () => any > : ^^^^^^^^^ >setCnt((prev) => prev + 1) : any +> : ^^^ >setCnt : any +> : ^^^ >(prev) => prev + 1 : (prev: any) => any > : ^ ^^^^^^^^^^^^^ >prev : any +> : ^^^ >prev + 1 : any +> : ^^^ >prev : any +> : ^^^ >1 : 1 > : ^ >type : string diff --git a/tests/baselines/reference/jsxImportForSideEffectsNonExtantNoError.errors.txt b/tests/baselines/reference/jsxImportForSideEffectsNonExtantNoError.errors.txt deleted file mode 100644 index c7c68d0a0c72e..0000000000000 --- a/tests/baselines/reference/jsxImportForSideEffectsNonExtantNoError.errors.txt +++ /dev/null @@ -1,13 +0,0 @@ -jsxImportForSideEffectsNonExtantNoError.tsx(4,8): error TS2882: Cannot find module or type declarations for side-effect import of './App.css'. - - -==== jsxImportForSideEffectsNonExtantNoError.tsx (1 errors) ==== - /// - import * as React from "react"; - - import "./App.css"; // doesn't actually exist - ~~~~~~~~~~~ -!!! error TS2882: Cannot find module or type declarations for side-effect import of './App.css'. - - const tag =
; - \ No newline at end of file diff --git a/tests/baselines/reference/jsxIntrinsicElementsTypeArgumentErrors.errors.txt b/tests/baselines/reference/jsxIntrinsicElementsTypeArgumentErrors.errors.txt deleted file mode 100644 index 1b4342381c8d9..0000000000000 --- a/tests/baselines/reference/jsxIntrinsicElementsTypeArgumentErrors.errors.txt +++ /dev/null @@ -1,98 +0,0 @@ -jsxIntrinsicElementsTypeArgumentErrors.tsx(5,15): error TS1099: Type argument list cannot be empty. -jsxIntrinsicElementsTypeArgumentErrors.tsx(7,16): error TS2558: Expected 0 type arguments, but got 1. -jsxIntrinsicElementsTypeArgumentErrors.tsx(7,22): error TS1009: Trailing comma not allowed. -jsxIntrinsicElementsTypeArgumentErrors.tsx(9,16): error TS2304: Cannot find name 'Missing'. -jsxIntrinsicElementsTypeArgumentErrors.tsx(9,16): error TS2558: Expected 0 type arguments, but got 1. -jsxIntrinsicElementsTypeArgumentErrors.tsx(11,16): error TS2304: Cannot find name 'Missing'. -jsxIntrinsicElementsTypeArgumentErrors.tsx(11,16): error TS2558: Expected 0 type arguments, but got 1. -jsxIntrinsicElementsTypeArgumentErrors.tsx(11,24): error TS2304: Cannot find name 'AlsoMissing'. -jsxIntrinsicElementsTypeArgumentErrors.tsx(13,16): error TS2558: Expected 0 type arguments, but got 1. -jsxIntrinsicElementsTypeArgumentErrors.tsx(13,23): error TS2344: Type 'object' does not satisfy the constraint 'string | number | symbol'. -jsxIntrinsicElementsTypeArgumentErrors.tsx(15,16): error TS2558: Expected 0 type arguments, but got 1. -jsxIntrinsicElementsTypeArgumentErrors.tsx(18,15): error TS1099: Type argument list cannot be empty. -jsxIntrinsicElementsTypeArgumentErrors.tsx(20,16): error TS2558: Expected 0 type arguments, but got 1. -jsxIntrinsicElementsTypeArgumentErrors.tsx(20,22): error TS1009: Trailing comma not allowed. -jsxIntrinsicElementsTypeArgumentErrors.tsx(22,16): error TS2304: Cannot find name 'Missing'. -jsxIntrinsicElementsTypeArgumentErrors.tsx(22,16): error TS2558: Expected 0 type arguments, but got 1. -jsxIntrinsicElementsTypeArgumentErrors.tsx(24,16): error TS2304: Cannot find name 'Missing'. -jsxIntrinsicElementsTypeArgumentErrors.tsx(24,16): error TS2558: Expected 0 type arguments, but got 1. -jsxIntrinsicElementsTypeArgumentErrors.tsx(24,24): error TS2304: Cannot find name 'AlsoMissing'. -jsxIntrinsicElementsTypeArgumentErrors.tsx(26,16): error TS2558: Expected 0 type arguments, but got 1. -jsxIntrinsicElementsTypeArgumentErrors.tsx(26,23): error TS2344: Type 'object' does not satisfy the constraint 'string | number | symbol'. -jsxIntrinsicElementsTypeArgumentErrors.tsx(28,16): error TS2558: Expected 0 type arguments, but got 1. - - -==== jsxIntrinsicElementsTypeArgumentErrors.tsx (22 errors) ==== - /// - import * as React from "react"; - - // opening + closing - const a = >
; // empty type args - ~~ -!!! error TS1099: Type argument list cannot be empty. - - const b = >
; // trailing comma type args - ~~~~~~~ -!!! error TS2558: Expected 0 type arguments, but got 1. - ~ -!!! error TS1009: Trailing comma not allowed. - - const c = >
; // nonexistant type args - ~~~~~~~ -!!! error TS2304: Cannot find name 'Missing'. - ~~~~~~~ -!!! error TS2558: Expected 0 type arguments, but got 1. - - const d = >>
; // nested missing type args - ~~~~~~~ -!!! error TS2304: Cannot find name 'Missing'. - ~~~~~~~~~~~~~~~~~~~~ -!!! error TS2558: Expected 0 type arguments, but got 1. - ~~~~~~~~~~~ -!!! error TS2304: Cannot find name 'AlsoMissing'. - - const e = >>
; // existing but incorrect nested type args - ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2558: Expected 0 type arguments, but got 1. - ~~~~~~ -!!! error TS2344: Type 'object' does not satisfy the constraint 'string | number | symbol'. - - const f = >
; // existing type argument with no internal issues - ~~~~~~ -!!! error TS2558: Expected 0 type arguments, but got 1. - - // self-closing - const g = />; // empty type args - ~~ -!!! error TS1099: Type argument list cannot be empty. - - const h = />; // trailing comma type args - ~~~~~~~ -!!! error TS2558: Expected 0 type arguments, but got 1. - ~ -!!! error TS1009: Trailing comma not allowed. - - const i = />; // nonexistant type args - ~~~~~~~ -!!! error TS2304: Cannot find name 'Missing'. - ~~~~~~~ -!!! error TS2558: Expected 0 type arguments, but got 1. - - const j = >/>; // nested missing type args - ~~~~~~~ -!!! error TS2304: Cannot find name 'Missing'. - ~~~~~~~~~~~~~~~~~~~~ -!!! error TS2558: Expected 0 type arguments, but got 1. - ~~~~~~~~~~~ -!!! error TS2304: Cannot find name 'AlsoMissing'. - - const k = >/>; // existing but incorrect nested type args - ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2558: Expected 0 type arguments, but got 1. - ~~~~~~ -!!! error TS2344: Type 'object' does not satisfy the constraint 'string | number | symbol'. - - const l = />; // existing type argument with no internal issues - ~~~~~~ -!!! error TS2558: Expected 0 type arguments, but got 1. - \ No newline at end of file diff --git a/tests/baselines/reference/jsxIssuesErrorWhenTagExpectsTooManyArguments.errors.txt b/tests/baselines/reference/jsxIssuesErrorWhenTagExpectsTooManyArguments.errors.txt deleted file mode 100644 index 0d3743ab397d0..0000000000000 --- a/tests/baselines/reference/jsxIssuesErrorWhenTagExpectsTooManyArguments.errors.txt +++ /dev/null @@ -1,35 +0,0 @@ -jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx(19,12): error TS6229: Tag 'MyComp4' expects at least '4' arguments, but the JSX factory 'React.createElement' provides at most '2'. -jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx(20,12): error TS6229: Tag 'MyComp3' expects at least '3' arguments, but the JSX factory 'React.createElement' provides at most '2'. - - -==== jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx (2 errors) ==== - /// - - import * as React from "react"; - - interface MyProps { - x: number; - } - - function MyComp4(props: MyProps, context: any, bad: any, verybad: any) { - return
; - } - function MyComp3(props: MyProps, context: any, bad: any) { - return
; - } - function MyComp2(props: MyProps, context: any) { - return
- } - - const a = ; // using `MyComp` as a component should error - it expects more arguments than react provides - ~~~~~~~ -!!! error TS6229: Tag 'MyComp4' expects at least '4' arguments, but the JSX factory 'React.createElement' provides at most '2'. -!!! related TS2728 jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx:9:10: 'MyComp4' is declared here. - const b = ; // using `MyComp` as a component should error - it expects more arguments than react provides - ~~~~~~~ -!!! error TS6229: Tag 'MyComp3' expects at least '3' arguments, but the JSX factory 'React.createElement' provides at most '2'. -!!! related TS2728 jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx:12:10: 'MyComp3' is declared here. - const c = ; // Should be OK, `context` is allowed, per react rules - - declare function MyTagWithOptionalNonJSXBits(props: MyProps, context: any, nonReactArg?: string): JSX.Element; - const d = ; // Technically OK, but probably questionable \ No newline at end of file diff --git a/tests/baselines/reference/jsxJsxsCjsTransformCustomImport(jsx=react-jsx).errors.txt b/tests/baselines/reference/jsxJsxsCjsTransformCustomImport(jsx=react-jsx).errors.txt deleted file mode 100644 index 248540ed384da..0000000000000 --- a/tests/baselines/reference/jsxJsxsCjsTransformCustomImport(jsx=react-jsx).errors.txt +++ /dev/null @@ -1,14 +0,0 @@ -jsxJsxsCjsTransformCustomImport.tsx(2,11): error TS2875: This JSX tag requires the module path 'preact/jsx-runtime' to exist, but none could be found. Make sure you have types for the appropriate package installed. - - -==== jsxJsxsCjsTransformCustomImport.tsx (1 errors) ==== - /// - const a = <> - ~~ -!!! error TS2875: This JSX tag requires the module path 'preact/jsx-runtime' to exist, but none could be found. Make sure you have types for the appropriate package installed. -

- text -
- - - export {}; \ No newline at end of file diff --git a/tests/baselines/reference/jsxJsxsCjsTransformCustomImport(jsx=react-jsxdev).errors.txt b/tests/baselines/reference/jsxJsxsCjsTransformCustomImport(jsx=react-jsxdev).errors.txt deleted file mode 100644 index e66480f8dce2f..0000000000000 --- a/tests/baselines/reference/jsxJsxsCjsTransformCustomImport(jsx=react-jsxdev).errors.txt +++ /dev/null @@ -1,14 +0,0 @@ -jsxJsxsCjsTransformCustomImport.tsx(2,11): error TS2875: This JSX tag requires the module path 'preact/jsx-dev-runtime' to exist, but none could be found. Make sure you have types for the appropriate package installed. - - -==== jsxJsxsCjsTransformCustomImport.tsx (1 errors) ==== - /// - const a = <> - ~~ -!!! error TS2875: This JSX tag requires the module path 'preact/jsx-dev-runtime' to exist, but none could be found. Make sure you have types for the appropriate package installed. -

- text -
- - - export {}; \ No newline at end of file diff --git a/tests/baselines/reference/jsxJsxsCjsTransformCustomImportPragma(jsx=react-jsx).errors.txt b/tests/baselines/reference/jsxJsxsCjsTransformCustomImportPragma(jsx=react-jsx).errors.txt deleted file mode 100644 index c37e010cab834..0000000000000 --- a/tests/baselines/reference/jsxJsxsCjsTransformCustomImportPragma(jsx=react-jsx).errors.txt +++ /dev/null @@ -1,26 +0,0 @@ -preact.tsx(3,11): error TS2875: This JSX tag requires the module path 'preact/jsx-runtime' to exist, but none could be found. Make sure you have types for the appropriate package installed. - - -==== react.tsx (0 errors) ==== - /// - /* @jsxImportSource react */ - import "./preact"; - const a = <> -

- text -
- - - export {}; -==== preact.tsx (1 errors) ==== - /// - /* @jsxImportSource preact */ - const a = <> - ~~ -!!! error TS2875: This JSX tag requires the module path 'preact/jsx-runtime' to exist, but none could be found. Make sure you have types for the appropriate package installed. -

- text -
- - - export {}; \ No newline at end of file diff --git a/tests/baselines/reference/jsxJsxsCjsTransformCustomImportPragma(jsx=react-jsxdev).errors.txt b/tests/baselines/reference/jsxJsxsCjsTransformCustomImportPragma(jsx=react-jsxdev).errors.txt deleted file mode 100644 index 79e8e02a87b2f..0000000000000 --- a/tests/baselines/reference/jsxJsxsCjsTransformCustomImportPragma(jsx=react-jsxdev).errors.txt +++ /dev/null @@ -1,26 +0,0 @@ -preact.tsx(3,11): error TS2875: This JSX tag requires the module path 'preact/jsx-dev-runtime' to exist, but none could be found. Make sure you have types for the appropriate package installed. - - -==== react.tsx (0 errors) ==== - /// - /* @jsxImportSource react */ - import "./preact"; - const a = <> -

- text -
- - - export {}; -==== preact.tsx (1 errors) ==== - /// - /* @jsxImportSource preact */ - const a = <> - ~~ -!!! error TS2875: This JSX tag requires the module path 'preact/jsx-dev-runtime' to exist, but none could be found. Make sure you have types for the appropriate package installed. -

- text -
- - - export {}; \ No newline at end of file diff --git a/tests/baselines/reference/jsxJsxsCjsTransformKeyPropCustomImport(jsx=react-jsx).errors.txt b/tests/baselines/reference/jsxJsxsCjsTransformKeyPropCustomImport(jsx=react-jsx).errors.txt deleted file mode 100644 index 4896710d1b567..0000000000000 --- a/tests/baselines/reference/jsxJsxsCjsTransformKeyPropCustomImport(jsx=react-jsx).errors.txt +++ /dev/null @@ -1,13 +0,0 @@ -jsxJsxsCjsTransformKeyPropCustomImport.tsx(3,11): error TS2875: This JSX tag requires the module path 'preact/jsx-runtime' to exist, but none could be found. Make sure you have types for the appropriate package installed. - - -==== jsxJsxsCjsTransformKeyPropCustomImport.tsx (1 errors) ==== - /// - const props = { answer: 42 } - const a =
text
; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2875: This JSX tag requires the module path 'preact/jsx-runtime' to exist, but none could be found. Make sure you have types for the appropriate package installed. - const b =
text
; - - export {}; - \ No newline at end of file diff --git a/tests/baselines/reference/jsxJsxsCjsTransformKeyPropCustomImport(jsx=react-jsxdev).errors.txt b/tests/baselines/reference/jsxJsxsCjsTransformKeyPropCustomImport(jsx=react-jsxdev).errors.txt deleted file mode 100644 index 27369617421b2..0000000000000 --- a/tests/baselines/reference/jsxJsxsCjsTransformKeyPropCustomImport(jsx=react-jsxdev).errors.txt +++ /dev/null @@ -1,13 +0,0 @@ -jsxJsxsCjsTransformKeyPropCustomImport.tsx(3,11): error TS2875: This JSX tag requires the module path 'preact/jsx-dev-runtime' to exist, but none could be found. Make sure you have types for the appropriate package installed. - - -==== jsxJsxsCjsTransformKeyPropCustomImport.tsx (1 errors) ==== - /// - const props = { answer: 42 } - const a =
text
; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2875: This JSX tag requires the module path 'preact/jsx-dev-runtime' to exist, but none could be found. Make sure you have types for the appropriate package installed. - const b =
text
; - - export {}; - \ No newline at end of file diff --git a/tests/baselines/reference/jsxJsxsCjsTransformKeyPropCustomImportPragma(jsx=react-jsx).errors.txt b/tests/baselines/reference/jsxJsxsCjsTransformKeyPropCustomImportPragma(jsx=react-jsx).errors.txt deleted file mode 100644 index b2f8739b7bcea..0000000000000 --- a/tests/baselines/reference/jsxJsxsCjsTransformKeyPropCustomImportPragma(jsx=react-jsx).errors.txt +++ /dev/null @@ -1,24 +0,0 @@ -preact.tsx(4,11): error TS2875: This JSX tag requires the module path 'preact/jsx-runtime' to exist, but none could be found. Make sure you have types for the appropriate package installed. - - -==== react.tsx (0 errors) ==== - /// - /* @jsxImportSource react */ - import "./preact"; - const props2 = { answer: 42 } - const a2 =
text
; - const b2 =
text
; - - export {}; - -==== preact.tsx (1 errors) ==== - /// - /* @jsxImportSource preact */ - const props = { answer: 42 } - const a =
text
; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2875: This JSX tag requires the module path 'preact/jsx-runtime' to exist, but none could be found. Make sure you have types for the appropriate package installed. - const b =
text
; - - export {}; - \ No newline at end of file diff --git a/tests/baselines/reference/jsxJsxsCjsTransformKeyPropCustomImportPragma(jsx=react-jsxdev).errors.txt b/tests/baselines/reference/jsxJsxsCjsTransformKeyPropCustomImportPragma(jsx=react-jsxdev).errors.txt deleted file mode 100644 index dabe922f6bf9f..0000000000000 --- a/tests/baselines/reference/jsxJsxsCjsTransformKeyPropCustomImportPragma(jsx=react-jsxdev).errors.txt +++ /dev/null @@ -1,24 +0,0 @@ -preact.tsx(4,11): error TS2875: This JSX tag requires the module path 'preact/jsx-dev-runtime' to exist, but none could be found. Make sure you have types for the appropriate package installed. - - -==== react.tsx (0 errors) ==== - /// - /* @jsxImportSource react */ - import "./preact"; - const props2 = { answer: 42 } - const a2 =
text
; - const b2 =
text
; - - export {}; - -==== preact.tsx (1 errors) ==== - /// - /* @jsxImportSource preact */ - const props = { answer: 42 } - const a =
text
; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2875: This JSX tag requires the module path 'preact/jsx-dev-runtime' to exist, but none could be found. Make sure you have types for the appropriate package installed. - const b =
text
; - - export {}; - \ No newline at end of file diff --git a/tests/baselines/reference/jsxNamespacedNameNotComparedToNonMatchingIndexSignature.types b/tests/baselines/reference/jsxNamespacedNameNotComparedToNonMatchingIndexSignature.types index 58bbd2330791b..931ffd431f603 100644 --- a/tests/baselines/reference/jsxNamespacedNameNotComparedToNonMatchingIndexSignature.types +++ b/tests/baselines/reference/jsxNamespacedNameNotComparedToNonMatchingIndexSignature.types @@ -33,6 +33,8 @@ export const tag =
> : ^^^ >ns:thing : string > : ^^^^^^ ->ns : error ->thing : error +>ns : any +> : ^^^ +>thing : any +> : ^^^ diff --git a/tests/baselines/reference/multiline.errors.txt b/tests/baselines/reference/multiline.errors.txt deleted file mode 100644 index a1f21e41de003..0000000000000 --- a/tests/baselines/reference/multiline.errors.txt +++ /dev/null @@ -1,60 +0,0 @@ -a.ts(12,1): error TS2578: Unused '@ts-expect-error' directive. -b.tsx(32,1): error TS2578: Unused '@ts-expect-error' directive. - - -==== a.ts (1 errors) ==== - export const texts: string[] = []; - - /** - @ts-ignore */ - texts.push(100); - - /** - @ts-expect-error */ - texts.push(100); - - /** - @ts-expect-error */ - ~~~~~~~~~~~~~~~~~~~~ -!!! error TS2578: Unused '@ts-expect-error' directive. - texts.push("100"); - -==== b.tsx (1 errors) ==== - import * as React from "react"; - - export function MyComponent(props: { foo: string }) { - return
; - } - - let x = ( -
- {/* - @ts-ignore */} - - - {/*@ts-ignore*/} - - - {/* - @ts-expect-error */} - - - {/* - // @ts-expect-error */} - - - {/* - * @ts-expect-error */} - - - {/*@ts-expect-error*/} - - - {/* - @ts-expect-error */} - ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2578: Unused '@ts-expect-error' directive. - -
- ); - \ No newline at end of file diff --git a/tests/baselines/reference/reactDefaultPropsInferenceSuccess.errors.txt b/tests/baselines/reference/reactDefaultPropsInferenceSuccess.errors.txt deleted file mode 100644 index 8d798bc537fef..0000000000000 --- a/tests/baselines/reference/reactDefaultPropsInferenceSuccess.errors.txt +++ /dev/null @@ -1,130 +0,0 @@ -reactDefaultPropsInferenceSuccess.tsx(27,36): error TS2769: No overload matches this call. - Overload 1 of 2, '(props: Readonly): FieldFeedback', gave the following error. - Type '(value: string) => void' is not assignable to type '"a" | "b" | ((value: string) => boolean) | undefined'. - Type '(value: string) => void' is not assignable to type '(value: string) => boolean'. - Type 'void' is not assignable to type 'boolean'. - Overload 2 of 2, '(props: Props, context?: any): FieldFeedback', gave the following error. - Type '(value: string) => void' is not assignable to type '"a" | "b" | ((value: string) => boolean) | undefined'. - Type '(value: string) => void' is not assignable to type '(value: string) => boolean'. - Type 'void' is not assignable to type 'boolean'. -reactDefaultPropsInferenceSuccess.tsx(43,41): error TS2769: No overload matches this call. - Overload 1 of 2, '(props: Readonly): FieldFeedbackBeta', gave the following error. - Type '(value: string) => void' is not assignable to type '"a" | "b" | ((value: string) => boolean) | undefined'. - Type '(value: string) => void' is not assignable to type '(value: string) => boolean'. - Type 'void' is not assignable to type 'boolean'. - Overload 2 of 2, '(props: Props, context?: any): FieldFeedbackBeta', gave the following error. - Type '(value: string) => void' is not assignable to type '"a" | "b" | ((value: string) => boolean) | undefined'. - Type '(value: string) => void' is not assignable to type '(value: string) => boolean'. - Type 'void' is not assignable to type 'boolean'. -reactDefaultPropsInferenceSuccess.tsx(64,37): error TS2769: No overload matches this call. - Overload 1 of 2, '(props: Readonly): FieldFeedback2', gave the following error. - Type '(value: string) => void' is not assignable to type '(value: string) => boolean'. - Type 'void' is not assignable to type 'boolean'. - Overload 2 of 2, '(props: MyPropsProps, context?: any): FieldFeedback2', gave the following error. - Type '(value: string) => void' is not assignable to type '(value: string) => boolean'. - Type 'void' is not assignable to type 'boolean'. - - -==== reactDefaultPropsInferenceSuccess.tsx (3 errors) ==== - /// - - import React from 'react'; - - interface BaseProps { - when?: ((value: string) => boolean) | "a" | "b"; - error?: boolean; - } - - interface Props extends BaseProps { - } - - class FieldFeedback

extends React.Component

{ - static defaultProps = { - when: () => true - }; - - render() { - return

Hello
; - } - } - - // OK - const Test1 = () => !!value} />; - - // Error: Void not assignable to boolean - const Test2 = () => console.log(value)} />; - ~~~~ -!!! error TS2769: No overload matches this call. -!!! error TS2769: Overload 1 of 2, '(props: Readonly): FieldFeedback', gave the following error. -!!! error TS2769: Type '(value: string) => void' is not assignable to type '"a" | "b" | ((value: string) => boolean) | undefined'. -!!! error TS2769: Type '(value: string) => void' is not assignable to type '(value: string) => boolean'. -!!! error TS2769: Type 'void' is not assignable to type 'boolean'. -!!! error TS2769: Overload 2 of 2, '(props: Props, context?: any): FieldFeedback', gave the following error. -!!! error TS2769: Type '(value: string) => void' is not assignable to type '"a" | "b" | ((value: string) => boolean) | undefined'. -!!! error TS2769: Type '(value: string) => void' is not assignable to type '(value: string) => boolean'. -!!! error TS2769: Type 'void' is not assignable to type 'boolean'. -!!! related TS6500 reactDefaultPropsInferenceSuccess.tsx:6:3: The expected type comes from property 'when' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes> & Pick & Readonly, "children" | "error"> & Partial & Readonly, "when">> & Partial boolean; }, never>>' -!!! related TS6500 reactDefaultPropsInferenceSuccess.tsx:6:3: The expected type comes from property 'when' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes> & Pick & Readonly, "children" | "error"> & Partial & Readonly, "when">> & Partial boolean; }, never>>' - - class FieldFeedbackBeta

extends React.Component

{ - static defaultProps: BaseProps = { - when: () => true - }; - - render() { - return

Hello
; - } - } - - // OK - const Test1a = () => !!value} error>Hah; - - // Error: Void not assignable to boolean - const Test2a = () => console.log(value)} error>Hah; - ~~~~ -!!! error TS2769: No overload matches this call. -!!! error TS2769: Overload 1 of 2, '(props: Readonly): FieldFeedbackBeta', gave the following error. -!!! error TS2769: Type '(value: string) => void' is not assignable to type '"a" | "b" | ((value: string) => boolean) | undefined'. -!!! error TS2769: Type '(value: string) => void' is not assignable to type '(value: string) => boolean'. -!!! error TS2769: Type 'void' is not assignable to type 'boolean'. -!!! error TS2769: Overload 2 of 2, '(props: Props, context?: any): FieldFeedbackBeta', gave the following error. -!!! error TS2769: Type '(value: string) => void' is not assignable to type '"a" | "b" | ((value: string) => boolean) | undefined'. -!!! error TS2769: Type '(value: string) => void' is not assignable to type '(value: string) => boolean'. -!!! error TS2769: Type 'void' is not assignable to type 'boolean'. -!!! related TS6500 reactDefaultPropsInferenceSuccess.tsx:6:3: The expected type comes from property 'when' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes> & Pick & Readonly, "children"> & Partial & Readonly, keyof Props>> & Partial>' -!!! related TS6500 reactDefaultPropsInferenceSuccess.tsx:6:3: The expected type comes from property 'when' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes> & Pick & Readonly, "children"> & Partial & Readonly, keyof Props>> & Partial>' - - interface MyPropsProps extends Props { - when: (value: string) => boolean; - } - - class FieldFeedback2

extends FieldFeedback

{ - static defaultProps = { - when: () => true - }; - - render() { - this.props.when("now"); // OK, always defined - return

Hello
; - } - } - - // OK - const Test3 = () => !!value} />; - - // Error: Void not assignable to boolean - const Test4 = () => console.log(value)} />; - ~~~~ -!!! error TS2769: No overload matches this call. -!!! error TS2769: Overload 1 of 2, '(props: Readonly): FieldFeedback2', gave the following error. -!!! error TS2769: Type '(value: string) => void' is not assignable to type '(value: string) => boolean'. -!!! error TS2769: Type 'void' is not assignable to type 'boolean'. -!!! error TS2769: Overload 2 of 2, '(props: MyPropsProps, context?: any): FieldFeedback2', gave the following error. -!!! error TS2769: Type '(value: string) => void' is not assignable to type '(value: string) => boolean'. -!!! error TS2769: Type 'void' is not assignable to type 'boolean'. -!!! related TS6500 reactDefaultPropsInferenceSuccess.tsx:46:3: The expected type comes from property 'when' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes> & Pick & Readonly, "children" | "error"> & Partial & Readonly, "when">> & Partial boolean; }, never>>' -!!! related TS6500 reactDefaultPropsInferenceSuccess.tsx:46:3: The expected type comes from property 'when' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes> & Pick & Readonly, "children" | "error"> & Partial & Readonly, "when">> & Partial boolean; }, never>>' - - // OK - const Test5 = () => ; - \ No newline at end of file diff --git a/tests/baselines/reference/returnTypePredicateIsInstantiateInContextOfTarget.types b/tests/baselines/reference/returnTypePredicateIsInstantiateInContextOfTarget.types index f2678d05d4294..6a284bcc02268 100644 --- a/tests/baselines/reference/returnTypePredicateIsInstantiateInContextOfTarget.types +++ b/tests/baselines/reference/returnTypePredicateIsInstantiateInContextOfTarget.types @@ -24,6 +24,7 @@ class TestComponent extends React.Component<{ isAny: (obj: any) => obj is T } >isAny : (obj: any) => obj is T > : ^ ^^ ^^ ^^^^^ >obj : any +> : ^^^ static defaultProps = { >defaultProps : { isAny: (obj: any) => obj is T; } @@ -47,6 +48,7 @@ class TestComponent extends React.Component<{ isAny: (obj: any) => obj is T } >isAny : (obj: any) => obj is T > : ^ ^^ ^^ ^^^^^ >obj : any +> : ^^^ return true; >true : true diff --git a/tests/baselines/reference/spellingSuggestionJSXAttribute.errors.txt b/tests/baselines/reference/spellingSuggestionJSXAttribute.errors.txt deleted file mode 100644 index 1972238cb1300..0000000000000 --- a/tests/baselines/reference/spellingSuggestionJSXAttribute.errors.txt +++ /dev/null @@ -1,79 +0,0 @@ -spellingSuggestionJSXAttribute.tsx(8,4): error TS2322: Type '{ class: string; }' is not assignable to type 'DetailedHTMLProps, HTMLAnchorElement>'. - Property 'class' does not exist on type 'DetailedHTMLProps, HTMLAnchorElement>'. Did you mean 'className'? -spellingSuggestionJSXAttribute.tsx(9,4): error TS2322: Type '{ for: string; }' is not assignable to type 'DetailedHTMLProps, HTMLAnchorElement>'. - Property 'for' does not exist on type 'DetailedHTMLProps, HTMLAnchorElement>'. -spellingSuggestionJSXAttribute.tsx(10,8): error TS2322: Type '{ for: string; }' is not assignable to type 'DetailedHTMLProps, HTMLLabelElement>'. - Property 'for' does not exist on type 'DetailedHTMLProps, HTMLLabelElement>'. Did you mean 'htmlFor'? -spellingSuggestionJSXAttribute.tsx(11,8): error TS2322: Type '{ for: string; class: string; }' is not assignable to type 'DetailedHTMLProps, HTMLLabelElement>'. - Property 'for' does not exist on type 'DetailedHTMLProps, HTMLLabelElement>'. Did you mean 'htmlFor'? -spellingSuggestionJSXAttribute.tsx(12,9): error TS2769: No overload matches this call. - Overload 1 of 2, '(props: Readonly<{ className?: string; htmlFor?: string; }>): MyComp', gave the following error. - Type '{ class: string; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes & Readonly<{ children?: ReactNode; }> & Readonly<{ className?: string; htmlFor?: string; }>'. - Property 'class' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes & Readonly<{ children?: ReactNode; }> & Readonly<{ className?: string; htmlFor?: string; }>'. Did you mean 'className'? - Overload 2 of 2, '(props: { className?: string; htmlFor?: string; }, context?: any): MyComp', gave the following error. - Type '{ class: string; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes & Readonly<{ children?: ReactNode; }> & Readonly<{ className?: string; htmlFor?: string; }>'. - Property 'class' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes & Readonly<{ children?: ReactNode; }> & Readonly<{ className?: string; htmlFor?: string; }>'. Did you mean 'className'? -spellingSuggestionJSXAttribute.tsx(13,10): error TS2322: Type '{ class: string; }' is not assignable to type 'IntrinsicAttributes & { className?: string; htmlFor?: string; }'. - Property 'class' does not exist on type 'IntrinsicAttributes & { className?: string; htmlFor?: string; }'. Did you mean 'className'? -spellingSuggestionJSXAttribute.tsx(14,9): error TS2769: No overload matches this call. - Overload 1 of 2, '(props: Readonly<{ className?: string; htmlFor?: string; }>): MyComp', gave the following error. - Type '{ for: string; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes & Readonly<{ children?: ReactNode; }> & Readonly<{ className?: string; htmlFor?: string; }>'. - Property 'for' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes & Readonly<{ children?: ReactNode; }> & Readonly<{ className?: string; htmlFor?: string; }>'. Did you mean 'htmlFor'? - Overload 2 of 2, '(props: { className?: string; htmlFor?: string; }, context?: any): MyComp', gave the following error. - Type '{ for: string; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes & Readonly<{ children?: ReactNode; }> & Readonly<{ className?: string; htmlFor?: string; }>'. - Property 'for' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes & Readonly<{ children?: ReactNode; }> & Readonly<{ className?: string; htmlFor?: string; }>'. Did you mean 'htmlFor'? -spellingSuggestionJSXAttribute.tsx(15,10): error TS2322: Type '{ for: string; }' is not assignable to type 'IntrinsicAttributes & { className?: string; htmlFor?: string; }'. - Property 'for' does not exist on type 'IntrinsicAttributes & { className?: string; htmlFor?: string; }'. Did you mean 'htmlFor'? - - -==== spellingSuggestionJSXAttribute.tsx (8 errors) ==== - /// - import * as React from "react"; - - function MyComp2(props: { className?: string, htmlFor?: string }) { - return null!; - } - class MyComp extends React.Component<{ className?: string, htmlFor?: string }> { } - ; - ~~~~~ -!!! error TS2322: Type '{ class: string; }' is not assignable to type 'DetailedHTMLProps, HTMLAnchorElement>'. -!!! error TS2322: Property 'class' does not exist on type 'DetailedHTMLProps, HTMLAnchorElement>'. Did you mean 'className'? - ; // should have no fix - ~~~ -!!! error TS2322: Type '{ for: string; }' is not assignable to type 'DetailedHTMLProps, HTMLAnchorElement>'. -!!! error TS2322: Property 'for' does not exist on type 'DetailedHTMLProps, HTMLAnchorElement>'. -