mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-11 02:15:10 -05:00
Add failing test
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
tests/cases/conformance/jsx/file.tsx(26,10): error TS2324: Property 'reqd' is missing in type 'IntrinsicAttributes & { reqd: any; }'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/jsx/react.d.ts (0 errors) ====
|
||||
|
||||
declare module JSX {
|
||||
interface Element { }
|
||||
interface IntrinsicElements {
|
||||
}
|
||||
interface ElementAttributesProperty {
|
||||
props;
|
||||
}
|
||||
interface IntrinsicAttributes {
|
||||
ref?: string;
|
||||
}
|
||||
}
|
||||
|
||||
==== tests/cases/conformance/jsx/file.tsx (1 errors) ====
|
||||
|
||||
declare class Component<P, S> {
|
||||
constructor(props?: P, context?: any);
|
||||
setState(f: (prevState: S, props: P) => S, callback?: () => any): void;
|
||||
setState(state: S, callback?: () => any): void;
|
||||
forceUpdate(callBack?: () => any): void;
|
||||
render(): JSX.Element;
|
||||
props: P;
|
||||
state: S;
|
||||
context: {};
|
||||
}
|
||||
|
||||
|
||||
interface ComponentClass<P> {
|
||||
new (props?: P, context?: any): Component<P, any>;
|
||||
}
|
||||
|
||||
declare module TestMod {
|
||||
interface TestClass extends ComponentClass<{reqd: any}> {
|
||||
}
|
||||
var Test: TestClass;
|
||||
}
|
||||
|
||||
// Errors correctly
|
||||
const T = TestMod.Test;
|
||||
var t1 = <T />;
|
||||
~~~~~
|
||||
!!! error TS2324: Property 'reqd' is missing in type 'IntrinsicAttributes & { reqd: any; }'.
|
||||
|
||||
// Should error
|
||||
var t2 = <TestMod.Test />;
|
||||
|
||||
|
||||
55
tests/baselines/reference/tsxAttributeResolution12.js
Normal file
55
tests/baselines/reference/tsxAttributeResolution12.js
Normal file
@@ -0,0 +1,55 @@
|
||||
//// [tests/cases/conformance/jsx/tsxAttributeResolution12.tsx] ////
|
||||
|
||||
//// [react.d.ts]
|
||||
|
||||
declare module JSX {
|
||||
interface Element { }
|
||||
interface IntrinsicElements {
|
||||
}
|
||||
interface ElementAttributesProperty {
|
||||
props;
|
||||
}
|
||||
interface IntrinsicAttributes {
|
||||
ref?: string;
|
||||
}
|
||||
}
|
||||
|
||||
//// [file.tsx]
|
||||
|
||||
declare class Component<P, S> {
|
||||
constructor(props?: P, context?: any);
|
||||
setState(f: (prevState: S, props: P) => S, callback?: () => any): void;
|
||||
setState(state: S, callback?: () => any): void;
|
||||
forceUpdate(callBack?: () => any): void;
|
||||
render(): JSX.Element;
|
||||
props: P;
|
||||
state: S;
|
||||
context: {};
|
||||
}
|
||||
|
||||
|
||||
interface ComponentClass<P> {
|
||||
new (props?: P, context?: any): Component<P, any>;
|
||||
}
|
||||
|
||||
declare module TestMod {
|
||||
interface TestClass extends ComponentClass<{reqd: any}> {
|
||||
}
|
||||
var Test: TestClass;
|
||||
}
|
||||
|
||||
// Errors correctly
|
||||
const T = TestMod.Test;
|
||||
var t1 = <T />;
|
||||
|
||||
// Should error
|
||||
var t2 = <TestMod.Test />;
|
||||
|
||||
|
||||
|
||||
//// [file.jsx]
|
||||
// Errors correctly
|
||||
var T = TestMod.Test;
|
||||
var t1 = <T />;
|
||||
// Should error
|
||||
var t2 = <TestMod.Test />;
|
||||
47
tests/baselines/reference/tsxAttributeResolution12.symbols
Normal file
47
tests/baselines/reference/tsxAttributeResolution12.symbols
Normal file
@@ -0,0 +1,47 @@
|
||||
=== tests/cases/conformance/jsx/react.d.ts ===
|
||||
|
||||
declare module JSX {
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 0, 0))
|
||||
|
||||
interface Element { }
|
||||
>Element : Symbol(Element, Decl(react.d.ts, 1, 20))
|
||||
|
||||
interface IntrinsicElements {
|
||||
>IntrinsicElements : Symbol(IntrinsicElements, Decl(react.d.ts, 2, 22))
|
||||
}
|
||||
interface ElementAttributesProperty {
|
||||
>ElementAttributesProperty : Symbol(ElementAttributesProperty, Decl(react.d.ts, 4, 2))
|
||||
|
||||
props;
|
||||
>props : Symbol(props, Decl(react.d.ts, 5, 38))
|
||||
}
|
||||
interface IntrinsicAttributes {
|
||||
>IntrinsicAttributes : Symbol(IntrinsicAttributes, Decl(react.d.ts, 7, 2))
|
||||
|
||||
ref?: string;
|
||||
>ref : Symbol(ref, Decl(react.d.ts, 8, 32))
|
||||
}
|
||||
}
|
||||
|
||||
=== tests/cases/conformance/jsx/file.tsx ===
|
||||
declare module TestMod {
|
||||
>TestMod : Symbol(TestMod, Decl(file.tsx, 0, 0))
|
||||
|
||||
interface TestClass {
|
||||
>TestClass : Symbol(TestClass, Decl(file.tsx, 0, 24))
|
||||
|
||||
props: { reqd: any };
|
||||
>props : Symbol(props, Decl(file.tsx, 1, 22))
|
||||
>reqd : Symbol(reqd, Decl(file.tsx, 2, 10))
|
||||
}
|
||||
var Test: TestClass;
|
||||
>Test : Symbol(Test, Decl(file.tsx, 4, 4))
|
||||
>TestClass : Symbol(TestClass, Decl(file.tsx, 0, 24))
|
||||
}
|
||||
|
||||
// Should error
|
||||
var test = <TestMod.Test />
|
||||
>test : Symbol(test, Decl(file.tsx, 8, 3))
|
||||
>Test : Symbol(TestMod.TestClass, Decl(file.tsx, 0, 24))
|
||||
|
||||
|
||||
49
tests/baselines/reference/tsxAttributeResolution12.types
Normal file
49
tests/baselines/reference/tsxAttributeResolution12.types
Normal file
@@ -0,0 +1,49 @@
|
||||
=== tests/cases/conformance/jsx/react.d.ts ===
|
||||
|
||||
declare module JSX {
|
||||
>JSX : any
|
||||
|
||||
interface Element { }
|
||||
>Element : Element
|
||||
|
||||
interface IntrinsicElements {
|
||||
>IntrinsicElements : IntrinsicElements
|
||||
}
|
||||
interface ElementAttributesProperty {
|
||||
>ElementAttributesProperty : ElementAttributesProperty
|
||||
|
||||
props;
|
||||
>props : any
|
||||
}
|
||||
interface IntrinsicAttributes {
|
||||
>IntrinsicAttributes : IntrinsicAttributes
|
||||
|
||||
ref?: string;
|
||||
>ref : string
|
||||
}
|
||||
}
|
||||
|
||||
=== tests/cases/conformance/jsx/file.tsx ===
|
||||
declare module TestMod {
|
||||
>TestMod : typeof TestMod
|
||||
|
||||
interface TestClass {
|
||||
>TestClass : TestClass
|
||||
|
||||
props: { reqd: any };
|
||||
>props : { reqd: any; }
|
||||
>reqd : any
|
||||
}
|
||||
var Test: TestClass;
|
||||
>Test : TestClass
|
||||
>TestClass : TestClass
|
||||
}
|
||||
|
||||
// Should error
|
||||
var test = <TestMod.Test />
|
||||
>test : JSX.Element
|
||||
><TestMod.Test /> : JSX.Element
|
||||
>TestMod : any
|
||||
>Test : any
|
||||
|
||||
|
||||
46
tests/cases/conformance/jsx/tsxAttributeResolution12.tsx
Normal file
46
tests/cases/conformance/jsx/tsxAttributeResolution12.tsx
Normal file
@@ -0,0 +1,46 @@
|
||||
//@jsx: preserve
|
||||
|
||||
//@filename: react.d.ts
|
||||
declare module JSX {
|
||||
interface Element { }
|
||||
interface IntrinsicElements {
|
||||
}
|
||||
interface ElementAttributesProperty {
|
||||
props;
|
||||
}
|
||||
interface IntrinsicAttributes {
|
||||
ref?: string;
|
||||
}
|
||||
}
|
||||
|
||||
//@filename: file.tsx
|
||||
|
||||
declare class Component<P, S> {
|
||||
constructor(props?: P, context?: any);
|
||||
setState(f: (prevState: S, props: P) => S, callback?: () => any): void;
|
||||
setState(state: S, callback?: () => any): void;
|
||||
forceUpdate(callBack?: () => any): void;
|
||||
render(): JSX.Element;
|
||||
props: P;
|
||||
state: S;
|
||||
context: {};
|
||||
}
|
||||
|
||||
|
||||
interface ComponentClass<P> {
|
||||
new (props?: P, context?: any): Component<P, any>;
|
||||
}
|
||||
|
||||
declare module TestMod {
|
||||
interface TestClass extends ComponentClass<{reqd: any}> {
|
||||
}
|
||||
var Test: TestClass;
|
||||
}
|
||||
|
||||
// Errors correctly
|
||||
const T = TestMod.Test;
|
||||
var t1 = <T />;
|
||||
|
||||
// Should error
|
||||
var t2 = <TestMod.Test />;
|
||||
|
||||
Reference in New Issue
Block a user