mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
49 lines
1014 B
TypeScript
49 lines
1014 B
TypeScript
//// [tests/cases/conformance/jsx/tsxElementResolution12.tsx] ////
|
|
|
|
//// [file.tsx]
|
|
declare namespace JSX {
|
|
interface Element { }
|
|
interface ElementAttributesProperty { pr: any; }
|
|
interface IntrinsicElements { }
|
|
}
|
|
|
|
interface Obj1type {
|
|
new(n: string): any;
|
|
}
|
|
declare var Obj1: Obj1type;
|
|
<Obj1 x={10} />; // OK
|
|
|
|
interface Obj2type {
|
|
new(n: string): { q?: number; pr: any };
|
|
}
|
|
declare var Obj2: Obj2type;
|
|
<Obj2 x={10} />; // OK
|
|
|
|
interface Obj3type {
|
|
new(n: string): { x: number; };
|
|
}
|
|
declare var Obj3: Obj3type;
|
|
<Obj3 x={10} />; // Error
|
|
var attributes: any;
|
|
<Obj3 {...attributes} />; // Error
|
|
<Obj3 {...{}} />; // OK
|
|
|
|
interface Obj4type {
|
|
new(n: string): { x: number; pr: { x: number; } };
|
|
}
|
|
declare var Obj4: Obj4type;
|
|
<Obj4 x={10} />; // OK
|
|
<Obj4 x={'10'} />; // Error
|
|
|
|
|
|
//// [file.jsx]
|
|
"use strict";
|
|
<Obj1 x={10}/>; // OK
|
|
<Obj2 x={10}/>; // OK
|
|
<Obj3 x={10}/>; // Error
|
|
var attributes;
|
|
<Obj3 {...attributes}/>; // Error
|
|
<Obj3 {...{}}/>; // OK
|
|
<Obj4 x={10}/>; // OK
|
|
<Obj4 x={'10'}/>; // Error
|