mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Merge pull request #16047 from Microsoft/sandersn/weakType
Weak type detection
This commit is contained in:
+68
-34
@@ -2285,7 +2285,7 @@ namespace ts {
|
||||
Debug.assert(typeNode !== undefined, "should always get typenode?");
|
||||
const options = { removeComments: true };
|
||||
const writer = createTextWriter("");
|
||||
const printer = createPrinter(options, writer);
|
||||
const printer = createPrinter(options);
|
||||
const sourceFile = enclosingDeclaration && getSourceFileOfNode(enclosingDeclaration);
|
||||
printer.writeNode(EmitHint.Unspecified, typeNode, /*sourceFile*/ sourceFile, writer);
|
||||
const result = writer.getText();
|
||||
@@ -8702,6 +8702,7 @@ namespace ts {
|
||||
let expandingFlags: number;
|
||||
let depth = 0;
|
||||
let overflow = false;
|
||||
let isIntersectionConstituent = false;
|
||||
|
||||
Debug.assert(relation !== identityRelation || !errorNode, "no error reporting in identity checking");
|
||||
|
||||
@@ -8784,7 +8785,6 @@ namespace ts {
|
||||
* * Ternary.False if they are not related.
|
||||
*/
|
||||
function isRelatedTo(source: Type, target: Type, reportErrors?: boolean, headMessage?: DiagnosticMessage): Ternary {
|
||||
let result: Ternary;
|
||||
if (source.flags & TypeFlags.StringOrNumberLiteral && source.flags & TypeFlags.FreshLiteral) {
|
||||
source = (<LiteralType>source).regularType;
|
||||
}
|
||||
@@ -8816,32 +8816,39 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
if (!(source.flags & TypeFlags.UnionOrIntersection) &&
|
||||
!(target.flags & TypeFlags.Union) &&
|
||||
!isIntersectionConstituent &&
|
||||
source !== globalObjectType &&
|
||||
getPropertiesOfType(source).length > 0 &&
|
||||
isWeakType(target) &&
|
||||
!hasCommonProperties(source, target)) {
|
||||
if (reportErrors) {
|
||||
reportError(Diagnostics.Type_0_has_no_properties_in_common_with_type_1, typeToString(source), typeToString(target));
|
||||
}
|
||||
return Ternary.False;
|
||||
}
|
||||
|
||||
let result = Ternary.False;
|
||||
const saveErrorInfo = errorInfo;
|
||||
const saveIsIntersectionConstituent = isIntersectionConstituent;
|
||||
isIntersectionConstituent = false;
|
||||
|
||||
// Note that these checks are specifically ordered to produce correct results. In particular,
|
||||
// we need to deconstruct unions before intersections (because unions are always at the top),
|
||||
// and we need to handle "each" relations before "some" relations for the same kind of type.
|
||||
if (source.flags & TypeFlags.Union) {
|
||||
if (relation === comparableRelation) {
|
||||
result = someTypeRelatedToType(source as UnionType, target, reportErrors && !(source.flags & TypeFlags.Primitive));
|
||||
}
|
||||
else {
|
||||
result = eachTypeRelatedToType(source as UnionType, target, reportErrors && !(source.flags & TypeFlags.Primitive));
|
||||
}
|
||||
if (result) {
|
||||
return result;
|
||||
}
|
||||
result = relation === comparableRelation ?
|
||||
someTypeRelatedToType(source as UnionType, target, reportErrors && !(source.flags & TypeFlags.Primitive)) :
|
||||
eachTypeRelatedToType(source as UnionType, target, reportErrors && !(source.flags & TypeFlags.Primitive));
|
||||
}
|
||||
else {
|
||||
if (target.flags & TypeFlags.Union) {
|
||||
if (result = typeRelatedToSomeType(source, <UnionType>target, reportErrors && !(source.flags & TypeFlags.Primitive) && !(target.flags & TypeFlags.Primitive))) {
|
||||
return result;
|
||||
}
|
||||
result = typeRelatedToSomeType(source, <UnionType>target, reportErrors && !(source.flags & TypeFlags.Primitive) && !(target.flags & TypeFlags.Primitive));
|
||||
}
|
||||
else if (target.flags & TypeFlags.Intersection) {
|
||||
if (result = typeRelatedToEachType(source, target as IntersectionType, reportErrors)) {
|
||||
return result;
|
||||
}
|
||||
isIntersectionConstituent = true;
|
||||
result = typeRelatedToEachType(source, target as IntersectionType, reportErrors);
|
||||
}
|
||||
else if (source.flags & TypeFlags.Intersection) {
|
||||
// Check to see if any constituents of the intersection are immediately related to the target.
|
||||
@@ -8857,20 +8864,18 @@ namespace ts {
|
||||
//
|
||||
// - For a primitive type or type parameter (such as 'number = A & B') there is no point in
|
||||
// breaking the intersection apart.
|
||||
if (result = someTypeRelatedToType(<IntersectionType>source, target, /*reportErrors*/ false)) {
|
||||
return result;
|
||||
}
|
||||
result = someTypeRelatedToType(<IntersectionType>source, target, /*reportErrors*/ false);
|
||||
}
|
||||
|
||||
if (source.flags & TypeFlags.StructuredOrTypeVariable || target.flags & TypeFlags.StructuredOrTypeVariable) {
|
||||
if (!result && (source.flags & TypeFlags.StructuredOrTypeVariable || target.flags & TypeFlags.StructuredOrTypeVariable)) {
|
||||
if (result = recursiveTypeRelatedTo(source, target, reportErrors)) {
|
||||
errorInfo = saveErrorInfo;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (reportErrors) {
|
||||
isIntersectionConstituent = saveIsIntersectionConstituent;
|
||||
|
||||
if (!result && reportErrors) {
|
||||
if (source.flags & TypeFlags.Object && target.flags & TypeFlags.Primitive) {
|
||||
tryElaborateErrorsForPrimitivesAndObjects(source, target);
|
||||
}
|
||||
@@ -8879,7 +8884,7 @@ namespace ts {
|
||||
}
|
||||
reportRelationError(headMessage, source, target);
|
||||
}
|
||||
return Ternary.False;
|
||||
return result;
|
||||
}
|
||||
|
||||
function isIdenticalTo(source: Type, target: Type): Ternary {
|
||||
@@ -8978,7 +8983,7 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
function typeRelatedToEachType(source: Type, target: UnionOrIntersectionType, reportErrors: boolean): Ternary {
|
||||
function typeRelatedToEachType(source: Type, target: IntersectionType, reportErrors: boolean): Ternary {
|
||||
let result = Ternary.True;
|
||||
const targetTypes = target.types;
|
||||
for (const targetType of targetTypes) {
|
||||
@@ -9280,7 +9285,6 @@ namespace ts {
|
||||
const requireOptionalProperties = relation === subtypeRelation && !(getObjectFlags(source) & ObjectFlags.ObjectLiteral);
|
||||
for (const targetProp of properties) {
|
||||
const sourceProp = getPropertyOfType(source, targetProp.name);
|
||||
|
||||
if (sourceProp !== targetProp) {
|
||||
if (!sourceProp) {
|
||||
if (!(targetProp.flags & SymbolFlags.Optional) || requireOptionalProperties) {
|
||||
@@ -9359,6 +9363,34 @@ namespace ts {
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* A type is 'weak' if it is an object type with at least one optional property
|
||||
* and no required properties, call/construct signatures or index signatures
|
||||
*/
|
||||
function isWeakType(type: Type): boolean {
|
||||
if (type.flags & TypeFlags.Object) {
|
||||
const resolved = resolveStructuredTypeMembers(<ObjectType>type);
|
||||
return resolved.callSignatures.length === 0 && resolved.constructSignatures.length === 0 &&
|
||||
!resolved.stringIndexInfo && !resolved.numberIndexInfo &&
|
||||
resolved.properties.length > 0 &&
|
||||
every(resolved.properties, p => !!(p.flags & SymbolFlags.Optional));
|
||||
}
|
||||
if (type.flags & TypeFlags.Intersection) {
|
||||
return every((<IntersectionType>type).types, isWeakType);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function hasCommonProperties(source: Type, target: Type) {
|
||||
const isComparingJsxAttributes = !!(source.flags & TypeFlags.JsxAttributes);
|
||||
for (const prop of getPropertiesOfType(source)) {
|
||||
if (isKnownProperty(target, prop.name, isComparingJsxAttributes)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function propertiesIdenticalTo(source: Type, target: Type): Ternary {
|
||||
if (!(source.flags & TypeFlags.Object && target.flags & TypeFlags.Object)) {
|
||||
return Ternary.False;
|
||||
@@ -14147,8 +14179,10 @@ namespace ts {
|
||||
function isKnownProperty(targetType: Type, name: string, isComparingJsxAttributes: boolean): boolean {
|
||||
if (targetType.flags & TypeFlags.Object) {
|
||||
const resolved = resolveStructuredTypeMembers(<ObjectType>targetType);
|
||||
if (resolved.stringIndexInfo || resolved.numberIndexInfo && isNumericLiteralName(name) ||
|
||||
getPropertyOfType(targetType, name) || isComparingJsxAttributes && !isUnhyphenatedJsxName(name)) {
|
||||
if (resolved.stringIndexInfo ||
|
||||
resolved.numberIndexInfo && isNumericLiteralName(name) ||
|
||||
getPropertyOfType(targetType, name) ||
|
||||
isComparingJsxAttributes && !isUnhyphenatedJsxName(name)) {
|
||||
// For JSXAttributes, if the attribute has a hyphenated name, consider that the attribute to be known.
|
||||
return true;
|
||||
}
|
||||
@@ -22704,12 +22738,12 @@ namespace ts {
|
||||
return symbols;
|
||||
}
|
||||
else if (symbol.flags & SymbolFlags.Transient) {
|
||||
if ((symbol as SymbolLinks).leftSpread) {
|
||||
const links = symbol as SymbolLinks;
|
||||
return [...getRootSymbols(links.leftSpread), ...getRootSymbols(links.rightSpread)];
|
||||
const transient = symbol as TransientSymbol;
|
||||
if (transient.leftSpread) {
|
||||
return [...getRootSymbols(transient.leftSpread), ...getRootSymbols(transient.rightSpread)];
|
||||
}
|
||||
if ((symbol as SymbolLinks).syntheticOrigin) {
|
||||
return getRootSymbols((symbol as SymbolLinks).syntheticOrigin);
|
||||
if (transient.syntheticOrigin) {
|
||||
return getRootSymbols(transient.syntheticOrigin);
|
||||
}
|
||||
|
||||
let target: Symbol;
|
||||
|
||||
@@ -1879,6 +1879,10 @@
|
||||
"category": "Error",
|
||||
"code": 2558
|
||||
},
|
||||
"Type '{0}' has no properties in common with type '{1}'.": {
|
||||
"category": "Error",
|
||||
"code": 2559
|
||||
},
|
||||
"JSX element attributes type '{0}' may not be a union type.": {
|
||||
"category": "Error",
|
||||
"code": 2600
|
||||
|
||||
@@ -11,7 +11,7 @@ declare var fs: {
|
||||
existsSync(path: string): boolean;
|
||||
readdirSync(path: string): string[];
|
||||
readFileSync(filename: string, encoding?: string): string;
|
||||
writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: number; flag?: string; }): void;
|
||||
writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: number; flag?: string; } | string): void;
|
||||
watchFile(filename: string, options: { persistent?: boolean; interval?: number; }, listener: (curr: { mtime: Date }, prev: { mtime: Date }) => void): void;
|
||||
};
|
||||
declare var path: any;
|
||||
|
||||
@@ -1,3 +1,12 @@
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersOptionality2.ts(33,5): error TS2559: Type 'D' has no properties in common with type 'C'.
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersOptionality2.ts(34,5): error TS2559: Type 'E' has no properties in common with type 'C'.
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersOptionality2.ts(35,5): error TS2559: Type 'F' has no properties in common with type 'C'.
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersOptionality2.ts(36,5): error TS2559: Type 'D' has no properties in common with type '{ opt?: Base; }'.
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersOptionality2.ts(37,5): error TS2559: Type 'E' has no properties in common with type '{ opt?: Base; }'.
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersOptionality2.ts(38,5): error TS2559: Type 'F' has no properties in common with type '{ opt?: Base; }'.
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersOptionality2.ts(39,5): error TS2559: Type 'D' has no properties in common with type '{ opt?: Base; }'.
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersOptionality2.ts(40,5): error TS2559: Type 'E' has no properties in common with type '{ opt?: Base; }'.
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersOptionality2.ts(41,5): error TS2559: Type 'F' has no properties in common with type '{ opt?: Base; }'.
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersOptionality2.ts(74,5): error TS2322: Type 'D' is not assignable to type 'C'.
|
||||
Property 'opt' is missing in type 'D'.
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersOptionality2.ts(75,5): error TS2322: Type 'E' is not assignable to type 'C'.
|
||||
@@ -18,7 +27,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme
|
||||
Property 'opt' is missing in type 'F'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersOptionality2.ts (9 errors) ====
|
||||
==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersOptionality2.ts (18 errors) ====
|
||||
// M is optional and S contains no property with the same name as M
|
||||
// N is optional and T contains no property with the same name as N
|
||||
|
||||
@@ -50,20 +59,38 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme
|
||||
var e: E;
|
||||
var f: F;
|
||||
|
||||
// all ok
|
||||
// disallowed by weak type checking
|
||||
c = d;
|
||||
~
|
||||
!!! error TS2559: Type 'D' has no properties in common with type 'C'.
|
||||
c = e;
|
||||
~
|
||||
!!! error TS2559: Type 'E' has no properties in common with type 'C'.
|
||||
c = f;
|
||||
c = a;
|
||||
|
||||
~
|
||||
!!! error TS2559: Type 'F' has no properties in common with type 'C'.
|
||||
a = d;
|
||||
~
|
||||
!!! error TS2559: Type 'D' has no properties in common with type '{ opt?: Base; }'.
|
||||
a = e;
|
||||
~
|
||||
!!! error TS2559: Type 'E' has no properties in common with type '{ opt?: Base; }'.
|
||||
a = f;
|
||||
a = c;
|
||||
|
||||
~
|
||||
!!! error TS2559: Type 'F' has no properties in common with type '{ opt?: Base; }'.
|
||||
b = d;
|
||||
~
|
||||
!!! error TS2559: Type 'D' has no properties in common with type '{ opt?: Base; }'.
|
||||
b = e;
|
||||
~
|
||||
!!! error TS2559: Type 'E' has no properties in common with type '{ opt?: Base; }'.
|
||||
b = f;
|
||||
~
|
||||
!!! error TS2559: Type 'F' has no properties in common with type '{ opt?: Base; }'.
|
||||
|
||||
// ok
|
||||
c = a;
|
||||
a = c;
|
||||
b = a;
|
||||
b = c;
|
||||
}
|
||||
@@ -134,4 +161,5 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme
|
||||
!!! error TS2322: Property 'opt' is missing in type 'F'.
|
||||
b = a; // ok
|
||||
b = c; // ok
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,20 +30,20 @@ module TargetHasOptional {
|
||||
var e: E;
|
||||
var f: F;
|
||||
|
||||
// all ok
|
||||
// disallowed by weak type checking
|
||||
c = d;
|
||||
c = e;
|
||||
c = f;
|
||||
c = a;
|
||||
|
||||
a = d;
|
||||
a = e;
|
||||
a = f;
|
||||
a = c;
|
||||
|
||||
b = d;
|
||||
b = e;
|
||||
b = f;
|
||||
|
||||
// ok
|
||||
c = a;
|
||||
a = c;
|
||||
b = a;
|
||||
b = c;
|
||||
}
|
||||
@@ -87,7 +87,8 @@ module SourceHasOptional {
|
||||
b = f; // error
|
||||
b = a; // ok
|
||||
b = c; // ok
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//// [assignmentCompatWithObjectMembersOptionality2.js]
|
||||
// M is optional and S contains no property with the same name as M
|
||||
@@ -129,18 +130,19 @@ var TargetHasOptional;
|
||||
var d;
|
||||
var e;
|
||||
var f;
|
||||
// all ok
|
||||
// disallowed by weak type checking
|
||||
c = d;
|
||||
c = e;
|
||||
c = f;
|
||||
c = a;
|
||||
a = d;
|
||||
a = e;
|
||||
a = f;
|
||||
a = c;
|
||||
b = d;
|
||||
b = e;
|
||||
b = f;
|
||||
// ok
|
||||
c = a;
|
||||
a = c;
|
||||
b = a;
|
||||
b = c;
|
||||
})(TargetHasOptional || (TargetHasOptional = {}));
|
||||
|
||||
@@ -13,8 +13,8 @@ interface Prop {
|
||||
|
||||
children: string | JSX.Element
|
||||
>children : Symbol(Prop.children, Decl(file.tsx, 4, 14))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2352, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2355, 27))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2353, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2356, 27))
|
||||
}
|
||||
|
||||
function Comp(p: Prop) {
|
||||
@@ -23,11 +23,11 @@ function Comp(p: Prop) {
|
||||
>Prop : Symbol(Prop, Decl(file.tsx, 0, 32))
|
||||
|
||||
return <div>{p.b}</div>;
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2399, 45))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2400, 45))
|
||||
>p.b : Symbol(Prop.b, Decl(file.tsx, 3, 14))
|
||||
>p : Symbol(p, Decl(file.tsx, 8, 14))
|
||||
>b : Symbol(Prop.b, Decl(file.tsx, 3, 14))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2399, 45))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2400, 45))
|
||||
}
|
||||
|
||||
// OK
|
||||
@@ -59,8 +59,8 @@ let k2 =
|
||||
>b : Symbol(b, Decl(file.tsx, 19, 16))
|
||||
|
||||
<div>hi hi hi!</div>
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2399, 45))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2399, 45))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2400, 45))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2400, 45))
|
||||
|
||||
</Comp>;
|
||||
>Comp : Symbol(Comp, Decl(file.tsx, 6, 1))
|
||||
|
||||
@@ -18,9 +18,9 @@ interface ButtonProp {
|
||||
|
||||
class Button extends React.Component<ButtonProp, any> {
|
||||
>Button : Symbol(Button, Decl(file.tsx, 6, 1))
|
||||
>React.Component : Symbol(React.Component, Decl(react.d.ts, 158, 55))
|
||||
>React.Component : Symbol(React.Component, Decl(react.d.ts, 158, 55), Decl(react.d.ts, 161, 66))
|
||||
>React : Symbol(React, Decl(file.tsx, 0, 0))
|
||||
>Component : Symbol(React.Component, Decl(react.d.ts, 158, 55))
|
||||
>Component : Symbol(React.Component, Decl(react.d.ts, 158, 55), Decl(react.d.ts, 161, 66))
|
||||
>ButtonProp : Symbol(ButtonProp, Decl(file.tsx, 0, 32))
|
||||
|
||||
render() {
|
||||
@@ -34,20 +34,20 @@ class Button extends React.Component<ButtonProp, any> {
|
||||
|
||||
return <InnerButton {...this.props} />
|
||||
>InnerButton : Symbol(InnerButton, Decl(file.tsx, 24, 1))
|
||||
>this.props : Symbol(React.Component.props, Decl(react.d.ts, 166, 37))
|
||||
>this.props : Symbol(React.Component.props, Decl(react.d.ts, 167, 37))
|
||||
>this : Symbol(Button, Decl(file.tsx, 6, 1))
|
||||
>props : Symbol(React.Component.props, Decl(react.d.ts, 166, 37))
|
||||
>props : Symbol(React.Component.props, Decl(react.d.ts, 167, 37))
|
||||
}
|
||||
else {
|
||||
return (<InnerButton {...this.props} >
|
||||
>InnerButton : Symbol(InnerButton, Decl(file.tsx, 24, 1))
|
||||
>this.props : Symbol(React.Component.props, Decl(react.d.ts, 166, 37))
|
||||
>this.props : Symbol(React.Component.props, Decl(react.d.ts, 167, 37))
|
||||
>this : Symbol(Button, Decl(file.tsx, 6, 1))
|
||||
>props : Symbol(React.Component.props, Decl(react.d.ts, 166, 37))
|
||||
>props : Symbol(React.Component.props, Decl(react.d.ts, 167, 37))
|
||||
|
||||
<div>Hello World</div>
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2399, 45))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2399, 45))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2400, 45))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2400, 45))
|
||||
|
||||
</InnerButton>);
|
||||
>InnerButton : Symbol(InnerButton, Decl(file.tsx, 24, 1))
|
||||
@@ -64,17 +64,17 @@ interface InnerButtonProp {
|
||||
|
||||
class InnerButton extends React.Component<InnerButtonProp, any> {
|
||||
>InnerButton : Symbol(InnerButton, Decl(file.tsx, 24, 1))
|
||||
>React.Component : Symbol(React.Component, Decl(react.d.ts, 158, 55))
|
||||
>React.Component : Symbol(React.Component, Decl(react.d.ts, 158, 55), Decl(react.d.ts, 161, 66))
|
||||
>React : Symbol(React, Decl(file.tsx, 0, 0))
|
||||
>Component : Symbol(React.Component, Decl(react.d.ts, 158, 55))
|
||||
>Component : Symbol(React.Component, Decl(react.d.ts, 158, 55), Decl(react.d.ts, 161, 66))
|
||||
>InnerButtonProp : Symbol(InnerButtonProp, Decl(file.tsx, 20, 1))
|
||||
|
||||
render() {
|
||||
>render : Symbol(InnerButton.render, Decl(file.tsx, 26, 65))
|
||||
|
||||
return (<button>Hello</button>);
|
||||
>button : Symbol(JSX.IntrinsicElements.button, Decl(react.d.ts, 2385, 43))
|
||||
>button : Symbol(JSX.IntrinsicElements.button, Decl(react.d.ts, 2385, 43))
|
||||
>button : Symbol(JSX.IntrinsicElements.button, Decl(react.d.ts, 2386, 43))
|
||||
>button : Symbol(JSX.IntrinsicElements.button, Decl(react.d.ts, 2386, 43))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,34 +16,34 @@ interface IFetchUserProps {
|
||||
>children : Symbol(IFetchUserProps.children, Decl(file.tsx, 6, 27))
|
||||
>user : Symbol(user, Decl(file.tsx, 7, 15))
|
||||
>IUser : Symbol(IUser, Decl(file.tsx, 0, 32))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2352, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2355, 27))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2353, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2356, 27))
|
||||
}
|
||||
|
||||
class FetchUser extends React.Component<IFetchUserProps, any> {
|
||||
>FetchUser : Symbol(FetchUser, Decl(file.tsx, 8, 1))
|
||||
>React.Component : Symbol(React.Component, Decl(react.d.ts, 158, 55))
|
||||
>React.Component : Symbol(React.Component, Decl(react.d.ts, 158, 55), Decl(react.d.ts, 161, 66))
|
||||
>React : Symbol(React, Decl(file.tsx, 0, 0))
|
||||
>Component : Symbol(React.Component, Decl(react.d.ts, 158, 55))
|
||||
>Component : Symbol(React.Component, Decl(react.d.ts, 158, 55), Decl(react.d.ts, 161, 66))
|
||||
>IFetchUserProps : Symbol(IFetchUserProps, Decl(file.tsx, 4, 1))
|
||||
|
||||
render() {
|
||||
>render : Symbol(FetchUser.render, Decl(file.tsx, 10, 63))
|
||||
|
||||
return this.state
|
||||
>this.state : Symbol(React.Component.state, Decl(react.d.ts, 173, 44))
|
||||
>this.state : Symbol(React.Component.state, Decl(react.d.ts, 174, 44))
|
||||
>this : Symbol(FetchUser, Decl(file.tsx, 8, 1))
|
||||
>state : Symbol(React.Component.state, Decl(react.d.ts, 173, 44))
|
||||
>state : Symbol(React.Component.state, Decl(react.d.ts, 174, 44))
|
||||
|
||||
? this.props.children(this.state.result)
|
||||
>this.props.children : Symbol(children, Decl(file.tsx, 6, 27), Decl(react.d.ts, 173, 20))
|
||||
>this.props : Symbol(React.Component.props, Decl(react.d.ts, 166, 37))
|
||||
>this.props.children : Symbol(children, Decl(file.tsx, 6, 27), Decl(react.d.ts, 174, 20))
|
||||
>this.props : Symbol(React.Component.props, Decl(react.d.ts, 167, 37))
|
||||
>this : Symbol(FetchUser, Decl(file.tsx, 8, 1))
|
||||
>props : Symbol(React.Component.props, Decl(react.d.ts, 166, 37))
|
||||
>children : Symbol(children, Decl(file.tsx, 6, 27), Decl(react.d.ts, 173, 20))
|
||||
>this.state : Symbol(React.Component.state, Decl(react.d.ts, 173, 44))
|
||||
>props : Symbol(React.Component.props, Decl(react.d.ts, 167, 37))
|
||||
>children : Symbol(children, Decl(file.tsx, 6, 27), Decl(react.d.ts, 174, 20))
|
||||
>this.state : Symbol(React.Component.state, Decl(react.d.ts, 174, 44))
|
||||
>this : Symbol(FetchUser, Decl(file.tsx, 8, 1))
|
||||
>state : Symbol(React.Component.state, Decl(react.d.ts, 173, 44))
|
||||
>state : Symbol(React.Component.state, Decl(react.d.ts, 174, 44))
|
||||
|
||||
: null;
|
||||
}
|
||||
@@ -61,11 +61,11 @@ function UserName0() {
|
||||
>user : Symbol(user, Decl(file.tsx, 22, 13))
|
||||
|
||||
<h1>{ user.Name }</h1>
|
||||
>h1 : Symbol(JSX.IntrinsicElements.h1, Decl(react.d.ts, 2409, 47))
|
||||
>h1 : Symbol(JSX.IntrinsicElements.h1, Decl(react.d.ts, 2410, 47))
|
||||
>user.Name : Symbol(IUser.Name, Decl(file.tsx, 2, 17))
|
||||
>user : Symbol(user, Decl(file.tsx, 22, 13))
|
||||
>Name : Symbol(IUser.Name, Decl(file.tsx, 2, 17))
|
||||
>h1 : Symbol(JSX.IntrinsicElements.h1, Decl(react.d.ts, 2409, 47))
|
||||
>h1 : Symbol(JSX.IntrinsicElements.h1, Decl(react.d.ts, 2410, 47))
|
||||
|
||||
) }
|
||||
</FetchUser>
|
||||
@@ -85,11 +85,11 @@ function UserName1() {
|
||||
>user : Symbol(user, Decl(file.tsx, 33, 13))
|
||||
|
||||
<h1>{ user.Name }</h1>
|
||||
>h1 : Symbol(JSX.IntrinsicElements.h1, Decl(react.d.ts, 2409, 47))
|
||||
>h1 : Symbol(JSX.IntrinsicElements.h1, Decl(react.d.ts, 2410, 47))
|
||||
>user.Name : Symbol(IUser.Name, Decl(file.tsx, 2, 17))
|
||||
>user : Symbol(user, Decl(file.tsx, 33, 13))
|
||||
>Name : Symbol(IUser.Name, Decl(file.tsx, 2, 17))
|
||||
>h1 : Symbol(JSX.IntrinsicElements.h1, Decl(react.d.ts, 2409, 47))
|
||||
>h1 : Symbol(JSX.IntrinsicElements.h1, Decl(react.d.ts, 2410, 47))
|
||||
|
||||
) }
|
||||
</FetchUser>
|
||||
|
||||
@@ -13,24 +13,24 @@ interface Prop {
|
||||
|
||||
children: JSX.Element | JSX.Element[];
|
||||
>children : Symbol(Prop.children, Decl(file.tsx, 4, 14))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2352, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2355, 27))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2352, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2355, 27))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2353, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2356, 27))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2353, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2356, 27))
|
||||
}
|
||||
|
||||
class Button extends React.Component<any, any> {
|
||||
>Button : Symbol(Button, Decl(file.tsx, 6, 1))
|
||||
>React.Component : Symbol(React.Component, Decl(react.d.ts, 158, 55))
|
||||
>React.Component : Symbol(React.Component, Decl(react.d.ts, 158, 55), Decl(react.d.ts, 161, 66))
|
||||
>React : Symbol(React, Decl(file.tsx, 0, 0))
|
||||
>Component : Symbol(React.Component, Decl(react.d.ts, 158, 55))
|
||||
>Component : Symbol(React.Component, Decl(react.d.ts, 158, 55), Decl(react.d.ts, 161, 66))
|
||||
|
||||
render() {
|
||||
>render : Symbol(Button.render, Decl(file.tsx, 8, 48))
|
||||
|
||||
return (<div>My Button</div>)
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2399, 45))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2399, 45))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2400, 45))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2400, 45))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,8 +39,8 @@ function AnotherButton(p: any) {
|
||||
>p : Symbol(p, Decl(file.tsx, 14, 23))
|
||||
|
||||
return <h1>Just Another Button</h1>;
|
||||
>h1 : Symbol(JSX.IntrinsicElements.h1, Decl(react.d.ts, 2409, 47))
|
||||
>h1 : Symbol(JSX.IntrinsicElements.h1, Decl(react.d.ts, 2409, 47))
|
||||
>h1 : Symbol(JSX.IntrinsicElements.h1, Decl(react.d.ts, 2410, 47))
|
||||
>h1 : Symbol(JSX.IntrinsicElements.h1, Decl(react.d.ts, 2410, 47))
|
||||
}
|
||||
|
||||
function Comp(p: Prop) {
|
||||
@@ -49,11 +49,11 @@ function Comp(p: Prop) {
|
||||
>Prop : Symbol(Prop, Decl(file.tsx, 0, 32))
|
||||
|
||||
return <div>{p.b}</div>;
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2399, 45))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2400, 45))
|
||||
>p.b : Symbol(Prop.b, Decl(file.tsx, 3, 14))
|
||||
>p : Symbol(p, Decl(file.tsx, 18, 14))
|
||||
>b : Symbol(Prop.b, Decl(file.tsx, 3, 14))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2399, 45))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2400, 45))
|
||||
}
|
||||
|
||||
// Ok
|
||||
|
||||
@@ -13,24 +13,24 @@ interface Prop {
|
||||
|
||||
children: string | JSX.Element | (string | JSX.Element)[];
|
||||
>children : Symbol(Prop.children, Decl(file.tsx, 4, 14))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2352, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2355, 27))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2352, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2355, 27))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2353, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2356, 27))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2353, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2356, 27))
|
||||
}
|
||||
|
||||
class Button extends React.Component<any, any> {
|
||||
>Button : Symbol(Button, Decl(file.tsx, 6, 1))
|
||||
>React.Component : Symbol(React.Component, Decl(react.d.ts, 158, 55))
|
||||
>React.Component : Symbol(React.Component, Decl(react.d.ts, 158, 55), Decl(react.d.ts, 161, 66))
|
||||
>React : Symbol(React, Decl(file.tsx, 0, 0))
|
||||
>Component : Symbol(React.Component, Decl(react.d.ts, 158, 55))
|
||||
>Component : Symbol(React.Component, Decl(react.d.ts, 158, 55), Decl(react.d.ts, 161, 66))
|
||||
|
||||
render() {
|
||||
>render : Symbol(Button.render, Decl(file.tsx, 8, 48))
|
||||
|
||||
return (<div>My Button</div>)
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2399, 45))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2399, 45))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2400, 45))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2400, 45))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,8 +39,8 @@ function AnotherButton(p: any) {
|
||||
>p : Symbol(p, Decl(file.tsx, 14, 23))
|
||||
|
||||
return <h1>Just Another Button</h1>;
|
||||
>h1 : Symbol(JSX.IntrinsicElements.h1, Decl(react.d.ts, 2409, 47))
|
||||
>h1 : Symbol(JSX.IntrinsicElements.h1, Decl(react.d.ts, 2409, 47))
|
||||
>h1 : Symbol(JSX.IntrinsicElements.h1, Decl(react.d.ts, 2410, 47))
|
||||
>h1 : Symbol(JSX.IntrinsicElements.h1, Decl(react.d.ts, 2410, 47))
|
||||
}
|
||||
|
||||
function Comp(p: Prop) {
|
||||
@@ -49,11 +49,11 @@ function Comp(p: Prop) {
|
||||
>Prop : Symbol(Prop, Decl(file.tsx, 0, 32))
|
||||
|
||||
return <div>{p.b}</div>;
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2399, 45))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2400, 45))
|
||||
>p.b : Symbol(Prop.b, Decl(file.tsx, 3, 14))
|
||||
>p : Symbol(p, Decl(file.tsx, 18, 14))
|
||||
>b : Symbol(Prop.b, Decl(file.tsx, 3, 14))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2399, 45))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2400, 45))
|
||||
}
|
||||
|
||||
// OK
|
||||
|
||||
@@ -5,26 +5,26 @@ import React = require('react');
|
||||
// OK
|
||||
let k1 = <div> <h2> Hello </h2> <h1> world </h1></div>;
|
||||
>k1 : Symbol(k1, Decl(file.tsx, 3, 3))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2399, 45))
|
||||
>h2 : Symbol(JSX.IntrinsicElements.h2, Decl(react.d.ts, 2410, 48))
|
||||
>h2 : Symbol(JSX.IntrinsicElements.h2, Decl(react.d.ts, 2410, 48))
|
||||
>h1 : Symbol(JSX.IntrinsicElements.h1, Decl(react.d.ts, 2409, 47))
|
||||
>h1 : Symbol(JSX.IntrinsicElements.h1, Decl(react.d.ts, 2409, 47))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2399, 45))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2400, 45))
|
||||
>h2 : Symbol(JSX.IntrinsicElements.h2, Decl(react.d.ts, 2411, 48))
|
||||
>h2 : Symbol(JSX.IntrinsicElements.h2, Decl(react.d.ts, 2411, 48))
|
||||
>h1 : Symbol(JSX.IntrinsicElements.h1, Decl(react.d.ts, 2410, 47))
|
||||
>h1 : Symbol(JSX.IntrinsicElements.h1, Decl(react.d.ts, 2410, 47))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2400, 45))
|
||||
|
||||
let k2 = <div> <h2> Hello </h2> {(user: any) => <h2>{user.name}</h2>}</div>;
|
||||
>k2 : Symbol(k2, Decl(file.tsx, 4, 3))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2399, 45))
|
||||
>h2 : Symbol(JSX.IntrinsicElements.h2, Decl(react.d.ts, 2410, 48))
|
||||
>h2 : Symbol(JSX.IntrinsicElements.h2, Decl(react.d.ts, 2410, 48))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2400, 45))
|
||||
>h2 : Symbol(JSX.IntrinsicElements.h2, Decl(react.d.ts, 2411, 48))
|
||||
>h2 : Symbol(JSX.IntrinsicElements.h2, Decl(react.d.ts, 2411, 48))
|
||||
>user : Symbol(user, Decl(file.tsx, 4, 34))
|
||||
>h2 : Symbol(JSX.IntrinsicElements.h2, Decl(react.d.ts, 2410, 48))
|
||||
>h2 : Symbol(JSX.IntrinsicElements.h2, Decl(react.d.ts, 2411, 48))
|
||||
>user : Symbol(user, Decl(file.tsx, 4, 34))
|
||||
>h2 : Symbol(JSX.IntrinsicElements.h2, Decl(react.d.ts, 2410, 48))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2399, 45))
|
||||
>h2 : Symbol(JSX.IntrinsicElements.h2, Decl(react.d.ts, 2411, 48))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2400, 45))
|
||||
|
||||
let k3 = <div> {1} {"That is a number"} </div>;
|
||||
>k3 : Symbol(k3, Decl(file.tsx, 5, 3))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2399, 45))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2399, 45))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2400, 45))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2400, 45))
|
||||
|
||||
|
||||
@@ -3,14 +3,14 @@ import React = require('react');
|
||||
>React : Symbol(React, Decl(file.tsx, 0, 0))
|
||||
|
||||
<div>
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2399, 45))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2400, 45))
|
||||
|
||||
// Not Comment
|
||||
</div>;
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2399, 45))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2400, 45))
|
||||
|
||||
<div>
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2399, 45))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2400, 45))
|
||||
|
||||
// Not Comment
|
||||
{
|
||||
@@ -18,10 +18,10 @@ import React = require('react');
|
||||
}
|
||||
// Another not Comment
|
||||
</div>;
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2399, 45))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2400, 45))
|
||||
|
||||
<div>
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2399, 45))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2400, 45))
|
||||
|
||||
// Not Comment
|
||||
{
|
||||
@@ -30,10 +30,10 @@ import React = require('react');
|
||||
}
|
||||
// Another not Comment
|
||||
</div>;
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2399, 45))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2400, 45))
|
||||
|
||||
<div>
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2399, 45))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2400, 45))
|
||||
|
||||
/* Not Comment */
|
||||
{
|
||||
@@ -41,5 +41,5 @@ import React = require('react');
|
||||
"Hi"
|
||||
}
|
||||
</div>;
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2399, 45))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2400, 45))
|
||||
|
||||
|
||||
@@ -247,7 +247,7 @@ function goo(x: X) {
|
||||
|
||||
x.y;
|
||||
>x.y : string
|
||||
>x : Y
|
||||
>x : X & Y
|
||||
>y : string
|
||||
}
|
||||
x;
|
||||
|
||||
@@ -11,17 +11,17 @@ let buttonProps; // any
|
||||
|
||||
let k = <button {...buttonProps}>
|
||||
>k : Symbol(k, Decl(0.tsx, 5, 3))
|
||||
>button : Symbol(JSX.IntrinsicElements.button, Decl(react.d.ts, 2385, 43))
|
||||
>button : Symbol(JSX.IntrinsicElements.button, Decl(react.d.ts, 2386, 43))
|
||||
>buttonProps : Symbol(buttonProps, Decl(0.tsx, 4, 3))
|
||||
|
||||
<span className={cx('class1', { class2: true })} />
|
||||
>span : Symbol(JSX.IntrinsicElements.span, Decl(react.d.ts, 2460, 51))
|
||||
>span : Symbol(JSX.IntrinsicElements.span, Decl(react.d.ts, 2461, 51))
|
||||
>className : Symbol(className, Decl(0.tsx, 6, 17))
|
||||
>cx : Symbol(cx, Decl(0.tsx, 1, 6))
|
||||
>class2 : Symbol(class2, Decl(0.tsx, 6, 43))
|
||||
|
||||
</button>;
|
||||
>button : Symbol(JSX.IntrinsicElements.button, Decl(react.d.ts, 2385, 43))
|
||||
>button : Symbol(JSX.IntrinsicElements.button, Decl(react.d.ts, 2386, 43))
|
||||
|
||||
=== tests/cases/conformance/jsx/declaration.d.ts ===
|
||||
declare module "classnames";
|
||||
|
||||
@@ -12,17 +12,17 @@ let buttonProps : {[attributeName: string]: ''}
|
||||
|
||||
let k = <button {...buttonProps}>
|
||||
>k : Symbol(k, Decl(0.tsx, 5, 3))
|
||||
>button : Symbol(JSX.IntrinsicElements.button, Decl(react.d.ts, 2385, 43))
|
||||
>button : Symbol(JSX.IntrinsicElements.button, Decl(react.d.ts, 2386, 43))
|
||||
>buttonProps : Symbol(buttonProps, Decl(0.tsx, 4, 3))
|
||||
|
||||
<span className={cx('class1', { class2: true })} />
|
||||
>span : Symbol(JSX.IntrinsicElements.span, Decl(react.d.ts, 2460, 51))
|
||||
>span : Symbol(JSX.IntrinsicElements.span, Decl(react.d.ts, 2461, 51))
|
||||
>className : Symbol(className, Decl(0.tsx, 6, 17))
|
||||
>cx : Symbol(cx, Decl(0.tsx, 1, 6))
|
||||
>class2 : Symbol(class2, Decl(0.tsx, 6, 43))
|
||||
|
||||
</button>;
|
||||
>button : Symbol(JSX.IntrinsicElements.button, Decl(react.d.ts, 2385, 43))
|
||||
>button : Symbol(JSX.IntrinsicElements.button, Decl(react.d.ts, 2386, 43))
|
||||
|
||||
=== tests/cases/conformance/jsx/declaration.d.ts ===
|
||||
declare module "classnames";
|
||||
|
||||
@@ -11,17 +11,17 @@ let buttonProps;
|
||||
|
||||
let k = <button {...buttonProps}>
|
||||
>k : Symbol(k, Decl(0.tsx, 5, 3))
|
||||
>button : Symbol(JSX.IntrinsicElements.button, Decl(react.d.ts, 2385, 43))
|
||||
>button : Symbol(JSX.IntrinsicElements.button, Decl(react.d.ts, 2386, 43))
|
||||
>buttonProps : Symbol(buttonProps, Decl(0.tsx, 4, 3))
|
||||
|
||||
<span className={cx('class1', { class2: true })} />
|
||||
>span : Symbol(JSX.IntrinsicElements.span, Decl(react.d.ts, 2460, 51))
|
||||
>span : Symbol(JSX.IntrinsicElements.span, Decl(react.d.ts, 2461, 51))
|
||||
>className : Symbol(className, Decl(0.tsx, 6, 17))
|
||||
>cx : Symbol(cx, Decl(0.tsx, 1, 6))
|
||||
>class2 : Symbol(class2, Decl(0.tsx, 6, 43))
|
||||
|
||||
</button>;
|
||||
>button : Symbol(JSX.IntrinsicElements.button, Decl(react.d.ts, 2385, 43))
|
||||
>button : Symbol(JSX.IntrinsicElements.button, Decl(react.d.ts, 2386, 43))
|
||||
|
||||
=== tests/cases/conformance/jsx/declaration.d.ts ===
|
||||
declare module "classnames";
|
||||
|
||||
@@ -12,7 +12,7 @@ let buttonProps : {[attributeName: string]: ''}
|
||||
|
||||
let k = <button {...buttonProps} className={cx('class1', { class2: true })} />;
|
||||
>k : Symbol(k, Decl(0.tsx, 5, 3))
|
||||
>button : Symbol(JSX.IntrinsicElements.button, Decl(react.d.ts, 2385, 43))
|
||||
>button : Symbol(JSX.IntrinsicElements.button, Decl(react.d.ts, 2386, 43))
|
||||
>buttonProps : Symbol(buttonProps, Decl(0.tsx, 4, 3))
|
||||
>className : Symbol(className, Decl(0.tsx, 5, 32))
|
||||
>cx : Symbol(cx, Decl(0.tsx, 1, 6))
|
||||
|
||||
@@ -4,9 +4,12 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW
|
||||
Property '1' is missing in type 'B2'.
|
||||
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithObjectMembers5.ts(32,11): error TS2420: Class 'B3' incorrectly implements interface 'A3'.
|
||||
Property ''1'' is missing in type 'B3'.
|
||||
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithObjectMembers5.ts(43,11): error TS2559: Type 'B' has no properties in common with type 'A'.
|
||||
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithObjectMembers5.ts(51,11): error TS2559: Type 'B2' has no properties in common with type 'A2'.
|
||||
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithObjectMembers5.ts(59,11): error TS2559: Type 'B3' has no properties in common with type 'A3'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithObjectMembers5.ts (3 errors) ====
|
||||
==== tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithObjectMembers5.ts (6 errors) ====
|
||||
interface Base {
|
||||
foo: string;
|
||||
}
|
||||
@@ -59,7 +62,9 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW
|
||||
}
|
||||
|
||||
class B implements A {
|
||||
fooo: Derived; // ok
|
||||
~
|
||||
!!! error TS2559: Type 'B' has no properties in common with type 'A'.
|
||||
fooo: Derived; // weak type error
|
||||
}
|
||||
|
||||
interface A2 {
|
||||
@@ -67,7 +72,9 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW
|
||||
}
|
||||
|
||||
class B2 implements A2 {
|
||||
2: Derived; // ok
|
||||
~~
|
||||
!!! error TS2559: Type 'B2' has no properties in common with type 'A2'.
|
||||
2: Derived; // weak type error
|
||||
}
|
||||
|
||||
interface A3 {
|
||||
@@ -75,6 +82,9 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW
|
||||
}
|
||||
|
||||
class B3 implements A3 {
|
||||
'1.0': Derived; // ok
|
||||
~~
|
||||
!!! error TS2559: Type 'B3' has no properties in common with type 'A3'.
|
||||
'1.0': Derived; // weak type error
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ module Optional {
|
||||
}
|
||||
|
||||
class B implements A {
|
||||
fooo: Derived; // ok
|
||||
fooo: Derived; // weak type error
|
||||
}
|
||||
|
||||
interface A2 {
|
||||
@@ -50,7 +50,7 @@ module Optional {
|
||||
}
|
||||
|
||||
class B2 implements A2 {
|
||||
2: Derived; // ok
|
||||
2: Derived; // weak type error
|
||||
}
|
||||
|
||||
interface A3 {
|
||||
@@ -58,9 +58,10 @@ module Optional {
|
||||
}
|
||||
|
||||
class B3 implements A3 {
|
||||
'1.0': Derived; // ok
|
||||
'1.0': Derived; // weak type error
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//// [subtypingWithObjectMembers5.js]
|
||||
// N and M have the same name, same accessibility, same optionality, and N is a subtype of M
|
||||
|
||||
@@ -69,8 +69,8 @@ var b: { Foo2: Derived; }
|
||||
>Derived : Derived
|
||||
|
||||
var r = true ? a : b; // ok
|
||||
>r : { Foo?: Base; }
|
||||
>true ? a : b : { Foo?: Base; }
|
||||
>r : { Foo?: Base; } | { Foo2: Derived; }
|
||||
>true ? a : b : { Foo?: Base; } | { Foo2: Derived; }
|
||||
>true : true
|
||||
>a : { Foo?: Base; }
|
||||
>b : { Foo2: Derived; }
|
||||
|
||||
@@ -69,8 +69,8 @@ var b: { Foo2?: Derived; }
|
||||
>Derived : Derived
|
||||
|
||||
var r = true ? a : b; // ok
|
||||
>r : { Foo2?: Derived; }
|
||||
>true ? a : b : { Foo2?: Derived; }
|
||||
>r : { Foo: Base; } | { Foo2?: Derived; }
|
||||
>true ? a : b : { Foo: Base; } | { Foo2?: Derived; }
|
||||
>true : true
|
||||
>a : { Foo: Base; }
|
||||
>b : { Foo2?: Derived; }
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
tests/cases/conformance/jsx/file.tsx(23,8): error TS2322: Type '{ x: "0"; }' is not assignable to type 'Attribs1'.
|
||||
Types of property 'x' are incompatible.
|
||||
Type '"0"' is not assignable to type 'number'.
|
||||
tests/cases/conformance/jsx/file.tsx(24,8): error TS2339: Property 'y' does not exist on type 'Attribs1'.
|
||||
tests/cases/conformance/jsx/file.tsx(25,8): error TS2339: Property 'y' does not exist on type 'Attribs1'.
|
||||
tests/cases/conformance/jsx/file.tsx(24,8): error TS2559: Type '{ y: 0; }' has no properties in common with type 'Attribs1'.
|
||||
tests/cases/conformance/jsx/file.tsx(25,8): error TS2559: Type '{ y: "foo"; }' has no properties in common with type 'Attribs1'.
|
||||
tests/cases/conformance/jsx/file.tsx(26,8): error TS2322: Type '{ x: "32"; }' is not assignable to type 'Attribs1'.
|
||||
Types of property 'x' are incompatible.
|
||||
Type '"32"' is not assignable to type 'number'.
|
||||
tests/cases/conformance/jsx/file.tsx(27,8): error TS2339: Property 'var' does not exist on type 'Attribs1'.
|
||||
tests/cases/conformance/jsx/file.tsx(27,8): error TS2559: Type '{ var: "10"; }' has no properties in common with type 'Attribs1'.
|
||||
tests/cases/conformance/jsx/file.tsx(29,1): error TS2322: Type '{}' is not assignable to type '{ reqd: string; }'.
|
||||
Property 'reqd' is missing in type '{}'.
|
||||
tests/cases/conformance/jsx/file.tsx(30,8): error TS2322: Type '{ reqd: 10; }' is not assignable to type '{ reqd: string; }'.
|
||||
@@ -44,10 +44,10 @@ tests/cases/conformance/jsx/file.tsx(30,8): error TS2322: Type '{ reqd: 10; }' i
|
||||
!!! error TS2322: Type '"0"' is not assignable to type 'number'.
|
||||
<test1 y={0} />; // Error, no property "y"
|
||||
~~~~~
|
||||
!!! error TS2339: Property 'y' does not exist on type 'Attribs1'.
|
||||
!!! error TS2559: Type '{ y: 0; }' has no properties in common with type 'Attribs1'.
|
||||
<test1 y="foo" />; // Error, no property "y"
|
||||
~~~~~~~
|
||||
!!! error TS2339: Property 'y' does not exist on type 'Attribs1'.
|
||||
!!! error TS2559: Type '{ y: "foo"; }' has no properties in common with type 'Attribs1'.
|
||||
<test1 x="32" />; // Error, "32" is not number
|
||||
~~~~~~
|
||||
!!! error TS2322: Type '{ x: "32"; }' is not assignable to type 'Attribs1'.
|
||||
@@ -55,7 +55,7 @@ tests/cases/conformance/jsx/file.tsx(30,8): error TS2322: Type '{ reqd: 10; }' i
|
||||
!!! error TS2322: Type '"32"' is not assignable to type 'number'.
|
||||
<test1 var="10" />; // Error, no 'var' property
|
||||
~~~~~~~~
|
||||
!!! error TS2339: Property 'var' does not exist on type 'Attribs1'.
|
||||
!!! error TS2559: Type '{ var: "10"; }' has no properties in common with type 'Attribs1'.
|
||||
|
||||
<test2 />; // Error, missing reqd
|
||||
~~~~~~~~~
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/conformance/jsx/file.tsx(11,22): error TS2339: Property 'bar' does not exist on type 'IntrinsicAttributes & { ref?: string; }'.
|
||||
tests/cases/conformance/jsx/file.tsx(11,22): error TS2559: Type '{ bar: "world"; }' has no properties in common with type 'IntrinsicAttributes & { ref?: string; }'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/jsx/react.d.ts (0 errors) ====
|
||||
@@ -27,6 +27,6 @@ tests/cases/conformance/jsx/file.tsx(11,22): error TS2339: Property 'bar' does n
|
||||
// Should be an OK
|
||||
var x = <MyComponent bar='world' />;
|
||||
~~~~~~~~~~~
|
||||
!!! error TS2339: Property 'bar' does not exist on type 'IntrinsicAttributes & { ref?: string; }'.
|
||||
!!! error TS2559: Type '{ bar: "world"; }' has no properties in common with type 'IntrinsicAttributes & { ref?: string; }'.
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/conformance/jsx/file.tsx(11,21): error TS2339: Property 'prop1' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<BigGreeter> & { children?: ReactNode; }'.
|
||||
tests/cases/conformance/jsx/file.tsx(11,21): error TS2559: Type '{ prop1: "hello"; }' has no properties in common with type 'IntrinsicAttributes & IntrinsicClassAttributes<BigGreeter> & { children?: ReactNode; }'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/jsx/file.tsx (1 errors) ====
|
||||
@@ -14,7 +14,7 @@ tests/cases/conformance/jsx/file.tsx(11,21): error TS2339: Property 'prop1' does
|
||||
// Error
|
||||
let a = <BigGreeter prop1="hello" />
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2339: Property 'prop1' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<BigGreeter> & { children?: ReactNode; }'.
|
||||
!!! error TS2559: Type '{ prop1: "hello"; }' has no properties in common with type 'IntrinsicAttributes & IntrinsicClassAttributes<BigGreeter> & { children?: ReactNode; }'.
|
||||
|
||||
// OK
|
||||
let b = <BigGreeter ref={(input) => { this.textInput = input; }} />
|
||||
|
||||
@@ -35,9 +35,9 @@ type Properties = CanadianAddress | AmericanAddress;
|
||||
|
||||
export class AddressComp extends React.Component<Properties, void> {
|
||||
>AddressComp : Symbol(AddressComp, Decl(file.tsx, 15, 52))
|
||||
>React.Component : Symbol(React.Component, Decl(react.d.ts, 158, 55))
|
||||
>React.Component : Symbol(React.Component, Decl(react.d.ts, 158, 55), Decl(react.d.ts, 161, 66))
|
||||
>React : Symbol(React, Decl(file.tsx, 0, 0))
|
||||
>Component : Symbol(React.Component, Decl(react.d.ts, 158, 55))
|
||||
>Component : Symbol(React.Component, Decl(react.d.ts, 158, 55), Decl(react.d.ts, 161, 66))
|
||||
>Properties : Symbol(Properties, Decl(file.tsx, 13, 1))
|
||||
|
||||
public render() {
|
||||
|
||||
@@ -10,17 +10,17 @@ interface Prop {
|
||||
}
|
||||
class Poisoned extends React.Component<Prop, {}> {
|
||||
>Poisoned : Symbol(Poisoned, Decl(file.tsx, 4, 1))
|
||||
>React.Component : Symbol(React.Component, Decl(react.d.ts, 158, 55))
|
||||
>React.Component : Symbol(React.Component, Decl(react.d.ts, 158, 55), Decl(react.d.ts, 161, 66))
|
||||
>React : Symbol(React, Decl(file.tsx, 0, 0))
|
||||
>Component : Symbol(React.Component, Decl(react.d.ts, 158, 55))
|
||||
>Component : Symbol(React.Component, Decl(react.d.ts, 158, 55), Decl(react.d.ts, 161, 66))
|
||||
>Prop : Symbol(Prop, Decl(file.tsx, 0, 32))
|
||||
|
||||
render() {
|
||||
>render : Symbol(Poisoned.render, Decl(file.tsx, 5, 50))
|
||||
|
||||
return <div>Hello</div>;
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2399, 45))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2399, 45))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2400, 45))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2400, 45))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,17 +10,17 @@ interface Prop {
|
||||
}
|
||||
class Poisoned extends React.Component<Prop, {}> {
|
||||
>Poisoned : Symbol(Poisoned, Decl(file.tsx, 4, 1))
|
||||
>React.Component : Symbol(React.Component, Decl(react.d.ts, 158, 55))
|
||||
>React.Component : Symbol(React.Component, Decl(react.d.ts, 158, 55), Decl(react.d.ts, 161, 66))
|
||||
>React : Symbol(React, Decl(file.tsx, 0, 0))
|
||||
>Component : Symbol(React.Component, Decl(react.d.ts, 158, 55))
|
||||
>Component : Symbol(React.Component, Decl(react.d.ts, 158, 55), Decl(react.d.ts, 161, 66))
|
||||
>Prop : Symbol(Prop, Decl(file.tsx, 0, 32))
|
||||
|
||||
render() {
|
||||
>render : Symbol(Poisoned.render, Decl(file.tsx, 5, 50))
|
||||
|
||||
return <div>Hello</div>;
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2399, 45))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2399, 45))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2400, 45))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2400, 45))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/conformance/jsx/file.tsx(17,7): error TS2339: Property 'x' does not exist on type '{ q?: number; }'.
|
||||
tests/cases/conformance/jsx/file.tsx(17,7): error TS2559: Type '{ x: 10; }' has no properties in common with type '{ q?: number; }'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/jsx/file.tsx (1 errors) ====
|
||||
@@ -20,7 +20,7 @@ tests/cases/conformance/jsx/file.tsx(17,7): error TS2339: Property 'x' does not
|
||||
var Obj2: Obj2type;
|
||||
<Obj2 x={10} />; // Error
|
||||
~~~~~~
|
||||
!!! error TS2339: Property 'x' does not exist on type '{ q?: number; }'.
|
||||
!!! error TS2559: Type '{ x: 10; }' has no properties in common with type '{ q?: number; }'.
|
||||
|
||||
interface Obj3type {
|
||||
new(n: string): { x: number; };
|
||||
|
||||
@@ -7,10 +7,10 @@ const decorator = function <T>(Component: React.StatelessComponent<T>): React.St
|
||||
>T : Symbol(T, Decl(file.tsx, 2, 28))
|
||||
>Component : Symbol(Component, Decl(file.tsx, 2, 31))
|
||||
>React : Symbol(React, Decl(file.tsx, 0, 0))
|
||||
>StatelessComponent : Symbol(React.StatelessComponent, Decl(react.d.ts, 197, 40))
|
||||
>StatelessComponent : Symbol(React.StatelessComponent, Decl(react.d.ts, 198, 40))
|
||||
>T : Symbol(T, Decl(file.tsx, 2, 28))
|
||||
>React : Symbol(React, Decl(file.tsx, 0, 0))
|
||||
>StatelessComponent : Symbol(React.StatelessComponent, Decl(react.d.ts, 197, 40))
|
||||
>StatelessComponent : Symbol(React.StatelessComponent, Decl(react.d.ts, 198, 40))
|
||||
>T : Symbol(T, Decl(file.tsx, 2, 28))
|
||||
|
||||
return (props) => <Component {...props}></Component>
|
||||
@@ -27,10 +27,10 @@ const decorator2 = function <T extends { x: number }>(Component: React.Stateless
|
||||
>x : Symbol(x, Decl(file.tsx, 6, 40))
|
||||
>Component : Symbol(Component, Decl(file.tsx, 6, 54))
|
||||
>React : Symbol(React, Decl(file.tsx, 0, 0))
|
||||
>StatelessComponent : Symbol(React.StatelessComponent, Decl(react.d.ts, 197, 40))
|
||||
>StatelessComponent : Symbol(React.StatelessComponent, Decl(react.d.ts, 198, 40))
|
||||
>T : Symbol(T, Decl(file.tsx, 6, 29))
|
||||
>React : Symbol(React, Decl(file.tsx, 0, 0))
|
||||
>StatelessComponent : Symbol(React.StatelessComponent, Decl(react.d.ts, 197, 40))
|
||||
>StatelessComponent : Symbol(React.StatelessComponent, Decl(react.d.ts, 198, 40))
|
||||
>T : Symbol(T, Decl(file.tsx, 6, 29))
|
||||
|
||||
return (props) => <Component {...props} x={2} ></Component>
|
||||
@@ -50,10 +50,10 @@ const decorator3 = function <T extends { x: number }, U extends { x: number } >(
|
||||
>x : Symbol(x, Decl(file.tsx, 10, 65))
|
||||
>Component : Symbol(Component, Decl(file.tsx, 10, 80))
|
||||
>React : Symbol(React, Decl(file.tsx, 0, 0))
|
||||
>StatelessComponent : Symbol(React.StatelessComponent, Decl(react.d.ts, 197, 40))
|
||||
>StatelessComponent : Symbol(React.StatelessComponent, Decl(react.d.ts, 198, 40))
|
||||
>T : Symbol(T, Decl(file.tsx, 10, 29))
|
||||
>React : Symbol(React, Decl(file.tsx, 0, 0))
|
||||
>StatelessComponent : Symbol(React.StatelessComponent, Decl(react.d.ts, 197, 40))
|
||||
>StatelessComponent : Symbol(React.StatelessComponent, Decl(react.d.ts, 198, 40))
|
||||
>T : Symbol(T, Decl(file.tsx, 10, 29))
|
||||
|
||||
return (props) => <Component x={2} {...props} ></Component>
|
||||
|
||||
@@ -7,25 +7,25 @@ class B1<T extends { x: string } = { x:string } > extends React.Component<T, {}>
|
||||
>T : Symbol(T, Decl(file.tsx, 2, 9))
|
||||
>x : Symbol(x, Decl(file.tsx, 2, 20))
|
||||
>x : Symbol(x, Decl(file.tsx, 2, 36))
|
||||
>React.Component : Symbol(React.Component, Decl(react.d.ts, 158, 55))
|
||||
>React.Component : Symbol(React.Component, Decl(react.d.ts, 158, 55), Decl(react.d.ts, 161, 66))
|
||||
>React : Symbol(React, Decl(file.tsx, 0, 0))
|
||||
>Component : Symbol(React.Component, Decl(react.d.ts, 158, 55))
|
||||
>Component : Symbol(React.Component, Decl(react.d.ts, 158, 55), Decl(react.d.ts, 161, 66))
|
||||
>T : Symbol(T, Decl(file.tsx, 2, 9))
|
||||
|
||||
render() {
|
||||
>render : Symbol(B1.render, Decl(file.tsx, 2, 82))
|
||||
|
||||
return <div>hi</div>;
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2399, 45))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2399, 45))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2400, 45))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2400, 45))
|
||||
}
|
||||
}
|
||||
class B<U> extends React.Component<U, {}> {
|
||||
>B : Symbol(B, Decl(file.tsx, 6, 1))
|
||||
>U : Symbol(U, Decl(file.tsx, 7, 8))
|
||||
>React.Component : Symbol(React.Component, Decl(react.d.ts, 158, 55))
|
||||
>React.Component : Symbol(React.Component, Decl(react.d.ts, 158, 55), Decl(react.d.ts, 161, 66))
|
||||
>React : Symbol(React, Decl(file.tsx, 0, 0))
|
||||
>Component : Symbol(React.Component, Decl(react.d.ts, 158, 55))
|
||||
>Component : Symbol(React.Component, Decl(react.d.ts, 158, 55), Decl(react.d.ts, 161, 66))
|
||||
>U : Symbol(U, Decl(file.tsx, 7, 8))
|
||||
|
||||
render() {
|
||||
@@ -33,9 +33,9 @@ class B<U> extends React.Component<U, {}> {
|
||||
|
||||
return <B1 {...this.props} x="hi" />;
|
||||
>B1 : Symbol(B1, Decl(file.tsx, 0, 32))
|
||||
>this.props : Symbol(React.Component.props, Decl(react.d.ts, 166, 37))
|
||||
>this.props : Symbol(React.Component.props, Decl(react.d.ts, 167, 37))
|
||||
>this : Symbol(B, Decl(file.tsx, 6, 1))
|
||||
>props : Symbol(React.Component.props, Decl(react.d.ts, 166, 37))
|
||||
>props : Symbol(React.Component.props, Decl(react.d.ts, 167, 37))
|
||||
>x : Symbol(x, Decl(file.tsx, 9, 34))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,25 +7,25 @@ class B1<T extends { x: string } = { x:string } > extends React.Component<T, {}>
|
||||
>T : Symbol(T, Decl(file.tsx, 2, 9))
|
||||
>x : Symbol(x, Decl(file.tsx, 2, 20))
|
||||
>x : Symbol(x, Decl(file.tsx, 2, 36))
|
||||
>React.Component : Symbol(React.Component, Decl(react.d.ts, 158, 55))
|
||||
>React.Component : Symbol(React.Component, Decl(react.d.ts, 158, 55), Decl(react.d.ts, 161, 66))
|
||||
>React : Symbol(React, Decl(file.tsx, 0, 0))
|
||||
>Component : Symbol(React.Component, Decl(react.d.ts, 158, 55))
|
||||
>Component : Symbol(React.Component, Decl(react.d.ts, 158, 55), Decl(react.d.ts, 161, 66))
|
||||
>T : Symbol(T, Decl(file.tsx, 2, 9))
|
||||
|
||||
render() {
|
||||
>render : Symbol(B1.render, Decl(file.tsx, 2, 82))
|
||||
|
||||
return <div>hi</div>;
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2399, 45))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2399, 45))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2400, 45))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2400, 45))
|
||||
}
|
||||
}
|
||||
class B<U> extends React.Component<U, {}> {
|
||||
>B : Symbol(B, Decl(file.tsx, 6, 1))
|
||||
>U : Symbol(U, Decl(file.tsx, 7, 8))
|
||||
>React.Component : Symbol(React.Component, Decl(react.d.ts, 158, 55))
|
||||
>React.Component : Symbol(React.Component, Decl(react.d.ts, 158, 55), Decl(react.d.ts, 161, 66))
|
||||
>React : Symbol(React, Decl(file.tsx, 0, 0))
|
||||
>Component : Symbol(React.Component, Decl(react.d.ts, 158, 55))
|
||||
>Component : Symbol(React.Component, Decl(react.d.ts, 158, 55), Decl(react.d.ts, 161, 66))
|
||||
>U : Symbol(U, Decl(file.tsx, 7, 8))
|
||||
|
||||
props: U;
|
||||
|
||||
@@ -7,8 +7,8 @@ declare function Component<T>(props: T) : JSX.Element;
|
||||
>T : Symbol(T, Decl(file.tsx, 2, 27))
|
||||
>props : Symbol(props, Decl(file.tsx, 2, 30))
|
||||
>T : Symbol(T, Decl(file.tsx, 2, 27))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2352, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2355, 27))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2353, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2356, 27))
|
||||
|
||||
const decorator = function <U>(props: U) {
|
||||
>decorator : Symbol(decorator, Decl(file.tsx, 3, 5))
|
||||
|
||||
@@ -7,8 +7,8 @@ declare function Component<T>(props: T) : JSX.Element;
|
||||
>T : Symbol(T, Decl(file.tsx, 2, 27))
|
||||
>props : Symbol(props, Decl(file.tsx, 2, 30))
|
||||
>T : Symbol(T, Decl(file.tsx, 2, 27))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2352, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2355, 27))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2353, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2356, 27))
|
||||
|
||||
const decorator = function <U>(props: U) {
|
||||
>decorator : Symbol(decorator, Decl(file.tsx, 3, 5))
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//// [file.tsx]
|
||||
import React = require('react');
|
||||
|
||||
export function makeP<P>(Ctor: React.ComponentClass<P>): React.ComponentClass<P> {
|
||||
export function makeP<P>(Ctor: React.ComponentClass<P>) {
|
||||
return class extends React.PureComponent<P, void> {
|
||||
public render(): JSX.Element {
|
||||
return (
|
||||
@@ -9,7 +9,9 @@ export function makeP<P>(Ctor: React.ComponentClass<P>): React.ComponentClass<P>
|
||||
);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//// [file.jsx]
|
||||
"use strict";
|
||||
|
||||
@@ -2,36 +2,35 @@
|
||||
import React = require('react');
|
||||
>React : Symbol(React, Decl(file.tsx, 0, 0))
|
||||
|
||||
export function makeP<P>(Ctor: React.ComponentClass<P>): React.ComponentClass<P> {
|
||||
export function makeP<P>(Ctor: React.ComponentClass<P>) {
|
||||
>makeP : Symbol(makeP, Decl(file.tsx, 0, 32))
|
||||
>P : Symbol(P, Decl(file.tsx, 2, 22))
|
||||
>Ctor : Symbol(Ctor, Decl(file.tsx, 2, 25))
|
||||
>React : Symbol(React, Decl(file.tsx, 0, 0))
|
||||
>ComponentClass : Symbol(React.ComponentClass, Decl(react.d.ts, 204, 5))
|
||||
>P : Symbol(P, Decl(file.tsx, 2, 22))
|
||||
>React : Symbol(React, Decl(file.tsx, 0, 0))
|
||||
>ComponentClass : Symbol(React.ComponentClass, Decl(react.d.ts, 204, 5))
|
||||
>ComponentClass : Symbol(React.ComponentClass, Decl(react.d.ts, 205, 5))
|
||||
>P : Symbol(P, Decl(file.tsx, 2, 22))
|
||||
|
||||
return class extends React.PureComponent<P, void> {
|
||||
>React.PureComponent : Symbol(React.PureComponent, Decl(react.d.ts, 179, 5))
|
||||
>React.PureComponent : Symbol(React.PureComponent, Decl(react.d.ts, 180, 5))
|
||||
>React : Symbol(React, Decl(file.tsx, 0, 0))
|
||||
>PureComponent : Symbol(React.PureComponent, Decl(react.d.ts, 179, 5))
|
||||
>PureComponent : Symbol(React.PureComponent, Decl(react.d.ts, 180, 5))
|
||||
>P : Symbol(P, Decl(file.tsx, 2, 22))
|
||||
|
||||
public render(): JSX.Element {
|
||||
>render : Symbol((Anonymous class).render, Decl(file.tsx, 3, 52))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2352, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2355, 27))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2353, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2356, 27))
|
||||
|
||||
return (
|
||||
<Ctor {...this.props } />
|
||||
>Ctor : Symbol(Ctor, Decl(file.tsx, 2, 25))
|
||||
>this.props : Symbol(React.Component.props, Decl(react.d.ts, 166, 37))
|
||||
>this.props : Symbol(React.Component.props, Decl(react.d.ts, 167, 37))
|
||||
>this : Symbol((Anonymous class), Decl(file.tsx, 3, 7))
|
||||
>props : Symbol(React.Component.props, Decl(react.d.ts, 166, 37))
|
||||
>props : Symbol(React.Component.props, Decl(react.d.ts, 167, 37))
|
||||
|
||||
);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -2,15 +2,12 @@
|
||||
import React = require('react');
|
||||
>React : typeof React
|
||||
|
||||
export function makeP<P>(Ctor: React.ComponentClass<P>): React.ComponentClass<P> {
|
||||
>makeP : <P>(Ctor: React.ComponentClass<P>) => React.ComponentClass<P>
|
||||
export function makeP<P>(Ctor: React.ComponentClass<P>) {
|
||||
>makeP : <P>(Ctor: React.ComponentClass<P>) => typeof (Anonymous class)
|
||||
>P : P
|
||||
>Ctor : React.ComponentClass<P>
|
||||
>React : any
|
||||
>ComponentClass : React.ComponentClass<P>
|
||||
>P : P
|
||||
>React : any
|
||||
>ComponentClass : React.ComponentClass<P>
|
||||
>P : P
|
||||
|
||||
return class extends React.PureComponent<P, void> {
|
||||
@@ -39,3 +36,5 @@ export function makeP<P>(Ctor: React.ComponentClass<P>): React.ComponentClass<P>
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -16,9 +16,9 @@ declare class MyComp<P = Prop> extends React.Component<P, {}> {
|
||||
>MyComp : Symbol(MyComp, Decl(file.tsx, 5, 1))
|
||||
>P : Symbol(P, Decl(file.tsx, 7, 21))
|
||||
>Prop : Symbol(Prop, Decl(file.tsx, 0, 32))
|
||||
>React.Component : Symbol(React.Component, Decl(react.d.ts, 158, 55))
|
||||
>React.Component : Symbol(React.Component, Decl(react.d.ts, 158, 55), Decl(react.d.ts, 161, 66))
|
||||
>React : Symbol(React, Decl(file.tsx, 0, 0))
|
||||
>Component : Symbol(React.Component, Decl(react.d.ts, 158, 55))
|
||||
>Component : Symbol(React.Component, Decl(react.d.ts, 158, 55), Decl(react.d.ts, 161, 66))
|
||||
>P : Symbol(P, Decl(file.tsx, 7, 21))
|
||||
|
||||
internalProp: P;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
tests/cases/conformance/jsx/file.tsx(16,17): error TS2339: Property 'a' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<MyComp<{}>> & { children?: ReactNode; }'.
|
||||
tests/cases/conformance/jsx/file.tsx(17,18): error TS2339: Property 'a' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<MyComp<{}>> & { children?: ReactNode; }'.
|
||||
tests/cases/conformance/jsx/file.tsx(16,17): error TS2559: Type '{ a: 10; b: "hi"; }' has no properties in common with type 'IntrinsicAttributes & IntrinsicClassAttributes<MyComp<{}>> & { children?: ReactNode; }'.
|
||||
tests/cases/conformance/jsx/file.tsx(17,18): error TS2559: Type '{ a: "hi"; }' has no properties in common with type 'IntrinsicAttributes & IntrinsicClassAttributes<MyComp<{}>> & { children?: ReactNode; }'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/jsx/file.tsx (2 errors) ====
|
||||
@@ -19,8 +19,8 @@ tests/cases/conformance/jsx/file.tsx(17,18): error TS2339: Property 'a' does not
|
||||
|
||||
// Error
|
||||
let x = <MyComp a={10} b="hi" />
|
||||
~~~~~~
|
||||
!!! error TS2339: Property 'a' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<MyComp<{}>> & { children?: ReactNode; }'.
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2559: Type '{ a: 10; b: "hi"; }' has no properties in common with type 'IntrinsicAttributes & IntrinsicClassAttributes<MyComp<{}>> & { children?: ReactNode; }'.
|
||||
let x2 = <MyComp a="hi"/>
|
||||
~~~~~~
|
||||
!!! error TS2339: Property 'a' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<MyComp<{}>> & { children?: ReactNode; }'.
|
||||
!!! error TS2559: Type '{ a: "hi"; }' has no properties in common with type 'IntrinsicAttributes & IntrinsicClassAttributes<MyComp<{}>> & { children?: ReactNode; }'.
|
||||
@@ -4,16 +4,16 @@ import React = require('react');
|
||||
|
||||
class Poisoned extends React.Component<{}, {}> {
|
||||
>Poisoned : Symbol(Poisoned, Decl(file.tsx, 0, 32))
|
||||
>React.Component : Symbol(React.Component, Decl(react.d.ts, 158, 55))
|
||||
>React.Component : Symbol(React.Component, Decl(react.d.ts, 158, 55), Decl(react.d.ts, 161, 66))
|
||||
>React : Symbol(React, Decl(file.tsx, 0, 0))
|
||||
>Component : Symbol(React.Component, Decl(react.d.ts, 158, 55))
|
||||
>Component : Symbol(React.Component, Decl(react.d.ts, 158, 55), Decl(react.d.ts, 161, 66))
|
||||
|
||||
render() {
|
||||
>render : Symbol(Poisoned.render, Decl(file.tsx, 2, 48))
|
||||
|
||||
return <div>Hello</div>;
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2399, 45))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2399, 45))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2400, 45))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2400, 45))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -39,17 +39,17 @@ interface Prop {
|
||||
|
||||
class OverWriteAttr extends React.Component<Prop, {}> {
|
||||
>OverWriteAttr : Symbol(OverWriteAttr, Decl(file.tsx, 15, 1))
|
||||
>React.Component : Symbol(React.Component, Decl(react.d.ts, 158, 55))
|
||||
>React.Component : Symbol(React.Component, Decl(react.d.ts, 158, 55), Decl(react.d.ts, 161, 66))
|
||||
>React : Symbol(React, Decl(file.tsx, 0, 0))
|
||||
>Component : Symbol(React.Component, Decl(react.d.ts, 158, 55))
|
||||
>Component : Symbol(React.Component, Decl(react.d.ts, 158, 55), Decl(react.d.ts, 161, 66))
|
||||
>Prop : Symbol(Prop, Decl(file.tsx, 9, 1))
|
||||
|
||||
render() {
|
||||
>render : Symbol(OverWriteAttr.render, Decl(file.tsx, 17, 55))
|
||||
|
||||
return <div>Hello</div>;
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2399, 45))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2399, 45))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2400, 45))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2400, 45))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -52,9 +52,9 @@ function ChildComponent({ property1 }: AnotherComponentProps) {
|
||||
|
||||
return (
|
||||
<span>{property1}</span>
|
||||
>span : Symbol(JSX.IntrinsicElements.span, Decl(react.d.ts, 2460, 51))
|
||||
>span : Symbol(JSX.IntrinsicElements.span, Decl(react.d.ts, 2461, 51))
|
||||
>property1 : Symbol(property1, Decl(file.tsx, 23, 25))
|
||||
>span : Symbol(JSX.IntrinsicElements.span, Decl(react.d.ts, 2460, 51))
|
||||
>span : Symbol(JSX.IntrinsicElements.span, Decl(react.d.ts, 2461, 51))
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
@@ -47,9 +47,9 @@ function AnotherComponent({ property1 }: AnotherComponentProps) {
|
||||
|
||||
return (
|
||||
<span>{property1}</span>
|
||||
>span : Symbol(JSX.IntrinsicElements.span, Decl(react.d.ts, 2460, 51))
|
||||
>span : Symbol(JSX.IntrinsicElements.span, Decl(react.d.ts, 2461, 51))
|
||||
>property1 : Symbol(property1, Decl(file.tsx, 19, 27))
|
||||
>span : Symbol(JSX.IntrinsicElements.span, Decl(react.d.ts, 2460, 51))
|
||||
>span : Symbol(JSX.IntrinsicElements.span, Decl(react.d.ts, 2461, 51))
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
@@ -14,17 +14,17 @@ interface PoisonedProp {
|
||||
|
||||
class Poisoned extends React.Component<PoisonedProp, {}> {
|
||||
>Poisoned : Symbol(Poisoned, Decl(file.tsx, 5, 1))
|
||||
>React.Component : Symbol(React.Component, Decl(react.d.ts, 158, 55))
|
||||
>React.Component : Symbol(React.Component, Decl(react.d.ts, 158, 55), Decl(react.d.ts, 161, 66))
|
||||
>React : Symbol(React, Decl(file.tsx, 0, 0))
|
||||
>Component : Symbol(React.Component, Decl(react.d.ts, 158, 55))
|
||||
>Component : Symbol(React.Component, Decl(react.d.ts, 158, 55), Decl(react.d.ts, 161, 66))
|
||||
>PoisonedProp : Symbol(PoisonedProp, Decl(file.tsx, 0, 32))
|
||||
|
||||
render() {
|
||||
>render : Symbol(Poisoned.render, Decl(file.tsx, 7, 58))
|
||||
|
||||
return <div>Hello</div>;
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2399, 45))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2399, 45))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2400, 45))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2400, 45))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,17 +14,17 @@ interface PoisonedProp {
|
||||
|
||||
class Poisoned extends React.Component<PoisonedProp, {}> {
|
||||
>Poisoned : Symbol(Poisoned, Decl(file.tsx, 5, 1))
|
||||
>React.Component : Symbol(React.Component, Decl(react.d.ts, 158, 55))
|
||||
>React.Component : Symbol(React.Component, Decl(react.d.ts, 158, 55), Decl(react.d.ts, 161, 66))
|
||||
>React : Symbol(React, Decl(file.tsx, 0, 0))
|
||||
>Component : Symbol(React.Component, Decl(react.d.ts, 158, 55))
|
||||
>Component : Symbol(React.Component, Decl(react.d.ts, 158, 55), Decl(react.d.ts, 161, 66))
|
||||
>PoisonedProp : Symbol(PoisonedProp, Decl(file.tsx, 0, 32))
|
||||
|
||||
render() {
|
||||
>render : Symbol(Poisoned.render, Decl(file.tsx, 7, 58))
|
||||
|
||||
return <div>Hello</div>;
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2399, 45))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2399, 45))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2400, 45))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2400, 45))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,16 +48,16 @@ let p = <Poisoned {...obj} />;
|
||||
|
||||
class EmptyProp extends React.Component<{}, {}> {
|
||||
>EmptyProp : Symbol(EmptyProp, Decl(file.tsx, 19, 30))
|
||||
>React.Component : Symbol(React.Component, Decl(react.d.ts, 158, 55))
|
||||
>React.Component : Symbol(React.Component, Decl(react.d.ts, 158, 55), Decl(react.d.ts, 161, 66))
|
||||
>React : Symbol(React, Decl(file.tsx, 0, 0))
|
||||
>Component : Symbol(React.Component, Decl(react.d.ts, 158, 55))
|
||||
>Component : Symbol(React.Component, Decl(react.d.ts, 158, 55), Decl(react.d.ts, 161, 66))
|
||||
|
||||
render() {
|
||||
>render : Symbol(EmptyProp.render, Decl(file.tsx, 21, 49))
|
||||
|
||||
return <div>Default hi</div>;
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2399, 45))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2399, 45))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2400, 45))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2400, 45))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,9 +2,10 @@ tests/cases/conformance/jsx/file.tsx(20,19): error TS2322: Type '{ x: string; y:
|
||||
Type '{ x: string; y: number; }' is not assignable to type 'PoisonedProp'.
|
||||
Types of property 'y' are incompatible.
|
||||
Type 'number' is not assignable to type '2'.
|
||||
tests/cases/conformance/jsx/file.tsx(33,20): error TS2559: Type '{ prop1: boolean; }' has no properties in common with type 'IntrinsicAttributes & IntrinsicClassAttributes<EmptyProp> & { children?: ReactNode; }'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/jsx/file.tsx (1 errors) ====
|
||||
==== tests/cases/conformance/jsx/file.tsx (2 errors) ====
|
||||
import React = require('react');
|
||||
|
||||
interface PoisonedProp {
|
||||
@@ -42,4 +43,6 @@ tests/cases/conformance/jsx/file.tsx(20,19): error TS2322: Type '{ x: string; y:
|
||||
prop1: false
|
||||
}
|
||||
// Ok
|
||||
let e = <EmptyProp {...o} />;
|
||||
let e = <EmptyProp {...o} />;
|
||||
~~~~~~
|
||||
!!! error TS2559: Type '{ prop1: boolean; }' has no properties in common with type 'IntrinsicAttributes & IntrinsicClassAttributes<EmptyProp> & { children?: ReactNode; }'.
|
||||
@@ -13,17 +13,17 @@ type TextProps = { editable: false }
|
||||
|
||||
class TextComponent extends React.Component<TextProps, {}> {
|
||||
>TextComponent : Symbol(TextComponent, Decl(file.tsx, 3, 71))
|
||||
>React.Component : Symbol(React.Component, Decl(react.d.ts, 158, 55))
|
||||
>React.Component : Symbol(React.Component, Decl(react.d.ts, 158, 55), Decl(react.d.ts, 161, 66))
|
||||
>React : Symbol(React, Decl(file.tsx, 0, 0))
|
||||
>Component : Symbol(React.Component, Decl(react.d.ts, 158, 55))
|
||||
>Component : Symbol(React.Component, Decl(react.d.ts, 158, 55), Decl(react.d.ts, 161, 66))
|
||||
>TextProps : Symbol(TextProps, Decl(file.tsx, 0, 32))
|
||||
|
||||
render() {
|
||||
>render : Symbol(TextComponent.render, Decl(file.tsx, 5, 60))
|
||||
|
||||
return <span>Some Text..</span>;
|
||||
>span : Symbol(JSX.IntrinsicElements.span, Decl(react.d.ts, 2460, 51))
|
||||
>span : Symbol(JSX.IntrinsicElements.span, Decl(react.d.ts, 2460, 51))
|
||||
>span : Symbol(JSX.IntrinsicElements.span, Decl(react.d.ts, 2461, 51))
|
||||
>span : Symbol(JSX.IntrinsicElements.span, Decl(react.d.ts, 2461, 51))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -36,17 +36,17 @@ interface Prop {
|
||||
|
||||
class OverWriteAttr extends React.Component<Prop, {}> {
|
||||
>OverWriteAttr : Symbol(OverWriteAttr, Decl(file.tsx, 15, 1))
|
||||
>React.Component : Symbol(React.Component, Decl(react.d.ts, 158, 55))
|
||||
>React.Component : Symbol(React.Component, Decl(react.d.ts, 158, 55), Decl(react.d.ts, 161, 66))
|
||||
>React : Symbol(React, Decl(file.tsx, 0, 0))
|
||||
>Component : Symbol(React.Component, Decl(react.d.ts, 158, 55))
|
||||
>Component : Symbol(React.Component, Decl(react.d.ts, 158, 55), Decl(react.d.ts, 161, 66))
|
||||
>Prop : Symbol(Prop, Decl(file.tsx, 9, 1))
|
||||
|
||||
render() {
|
||||
>render : Symbol(OverWriteAttr.render, Decl(file.tsx, 17, 55))
|
||||
|
||||
return <div>Hello</div>;
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2399, 45))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2399, 45))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2400, 45))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2400, 45))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,17 +14,17 @@ interface OptionProp {
|
||||
|
||||
class Opt extends React.Component<OptionProp, {}> {
|
||||
>Opt : Symbol(Opt, Decl(file.tsx, 5, 1))
|
||||
>React.Component : Symbol(React.Component, Decl(react.d.ts, 158, 55))
|
||||
>React.Component : Symbol(React.Component, Decl(react.d.ts, 158, 55), Decl(react.d.ts, 161, 66))
|
||||
>React : Symbol(React, Decl(file.tsx, 0, 0))
|
||||
>Component : Symbol(React.Component, Decl(react.d.ts, 158, 55))
|
||||
>Component : Symbol(React.Component, Decl(react.d.ts, 158, 55), Decl(react.d.ts, 161, 66))
|
||||
>OptionProp : Symbol(OptionProp, Decl(file.tsx, 0, 32))
|
||||
|
||||
render() {
|
||||
>render : Symbol(Opt.render, Decl(file.tsx, 7, 51))
|
||||
|
||||
return <div>Hello</div>;
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2399, 45))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2399, 45))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2400, 45))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2400, 45))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -33,11 +33,11 @@ declare function TestingOptional(a: {y1: boolean, y2?: number, y3: boolean}): JS
|
||||
|
||||
// OK
|
||||
const e1 = <TestingOptional />
|
||||
const e2 = <TestingOptional extra-prop/>
|
||||
const e3 = <TestingOptional y1="hello"/>
|
||||
const e4 = <TestingOptional y1="hello" y2={1000} />
|
||||
const e5 = <TestingOptional y1 y3/>
|
||||
const e6 = <TestingOptional y1 y3 y2={10} />
|
||||
const e2 = <TestingOptional y1 y3 extra-prop/>
|
||||
|
||||
|
||||
|
||||
@@ -60,9 +60,9 @@ define(["require", "exports", "react"], function (require, exports, React) {
|
||||
var d5 = <TestingOneThing extra-data="hello" yy="hello" name="Bob"/>;
|
||||
// OK
|
||||
var e1 = <TestingOptional />;
|
||||
var e2 = <TestingOptional extra-prop/>;
|
||||
var e3 = <TestingOptional y1="hello"/>;
|
||||
var e4 = <TestingOptional y1="hello" y2={1000}/>;
|
||||
var e5 = <TestingOptional y1 y3/>;
|
||||
var e6 = <TestingOptional y1 y3 y2={10}/>;
|
||||
var e2 = <TestingOptional y1 y3 extra-prop/>;
|
||||
});
|
||||
|
||||
@@ -6,24 +6,24 @@ declare function OneThing(k: {yxx: string}): JSX.Element;
|
||||
>OneThing : Symbol(OneThing, Decl(file.tsx, 0, 31), Decl(file.tsx, 2, 57), Decl(file.tsx, 3, 76), Decl(file.tsx, 4, 69), Decl(file.tsx, 5, 83))
|
||||
>k : Symbol(k, Decl(file.tsx, 2, 26))
|
||||
>yxx : Symbol(yxx, Decl(file.tsx, 2, 30))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2352, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2355, 27))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2353, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2356, 27))
|
||||
|
||||
declare function OneThing(k: {yxx1: string, children: string}): JSX.Element;
|
||||
>OneThing : Symbol(OneThing, Decl(file.tsx, 0, 31), Decl(file.tsx, 2, 57), Decl(file.tsx, 3, 76), Decl(file.tsx, 4, 69), Decl(file.tsx, 5, 83))
|
||||
>k : Symbol(k, Decl(file.tsx, 3, 26))
|
||||
>yxx1 : Symbol(yxx1, Decl(file.tsx, 3, 30))
|
||||
>children : Symbol(children, Decl(file.tsx, 3, 43))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2352, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2355, 27))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2353, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2356, 27))
|
||||
|
||||
declare function OneThing(l: {yy: number, yy1: string}): JSX.Element;
|
||||
>OneThing : Symbol(OneThing, Decl(file.tsx, 0, 31), Decl(file.tsx, 2, 57), Decl(file.tsx, 3, 76), Decl(file.tsx, 4, 69), Decl(file.tsx, 5, 83))
|
||||
>l : Symbol(l, Decl(file.tsx, 4, 26))
|
||||
>yy : Symbol(yy, Decl(file.tsx, 4, 30))
|
||||
>yy1 : Symbol(yy1, Decl(file.tsx, 4, 41))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2352, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2355, 27))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2353, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2356, 27))
|
||||
|
||||
declare function OneThing(l: {yy: number, yy1: string, yy2: boolean}): JSX.Element;
|
||||
>OneThing : Symbol(OneThing, Decl(file.tsx, 0, 31), Decl(file.tsx, 2, 57), Decl(file.tsx, 3, 76), Decl(file.tsx, 4, 69), Decl(file.tsx, 5, 83))
|
||||
@@ -31,15 +31,15 @@ declare function OneThing(l: {yy: number, yy1: string, yy2: boolean}): JSX.Eleme
|
||||
>yy : Symbol(yy, Decl(file.tsx, 5, 30))
|
||||
>yy1 : Symbol(yy1, Decl(file.tsx, 5, 41))
|
||||
>yy2 : Symbol(yy2, Decl(file.tsx, 5, 54))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2352, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2355, 27))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2353, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2356, 27))
|
||||
|
||||
declare function OneThing(l1: {data: string, "data-prop": boolean}): JSX.Element;
|
||||
>OneThing : Symbol(OneThing, Decl(file.tsx, 0, 31), Decl(file.tsx, 2, 57), Decl(file.tsx, 3, 76), Decl(file.tsx, 4, 69), Decl(file.tsx, 5, 83))
|
||||
>l1 : Symbol(l1, Decl(file.tsx, 6, 26))
|
||||
>data : Symbol(data, Decl(file.tsx, 6, 31))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2352, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2355, 27))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2353, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2356, 27))
|
||||
|
||||
// OK
|
||||
const c1 = <OneThing yxx='ok' />
|
||||
@@ -76,31 +76,31 @@ declare function TestingOneThing({y1: string}): JSX.Element;
|
||||
>TestingOneThing : Symbol(TestingOneThing, Decl(file.tsx, 13, 47), Decl(file.tsx, 16, 60), Decl(file.tsx, 17, 86), Decl(file.tsx, 18, 83))
|
||||
>y1 : Symbol(y1)
|
||||
>string : Symbol(string, Decl(file.tsx, 16, 34))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2352, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2355, 27))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2353, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2356, 27))
|
||||
|
||||
declare function TestingOneThing(j: {"extra-data": string, yy?: string}): JSX.Element;
|
||||
>TestingOneThing : Symbol(TestingOneThing, Decl(file.tsx, 13, 47), Decl(file.tsx, 16, 60), Decl(file.tsx, 17, 86), Decl(file.tsx, 18, 83))
|
||||
>j : Symbol(j, Decl(file.tsx, 17, 33))
|
||||
>yy : Symbol(yy, Decl(file.tsx, 17, 58))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2352, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2355, 27))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2353, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2356, 27))
|
||||
|
||||
declare function TestingOneThing(n: {yy: number, direction?: number}): JSX.Element;
|
||||
>TestingOneThing : Symbol(TestingOneThing, Decl(file.tsx, 13, 47), Decl(file.tsx, 16, 60), Decl(file.tsx, 17, 86), Decl(file.tsx, 18, 83))
|
||||
>n : Symbol(n, Decl(file.tsx, 18, 33))
|
||||
>yy : Symbol(yy, Decl(file.tsx, 18, 37))
|
||||
>direction : Symbol(direction, Decl(file.tsx, 18, 48))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2352, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2355, 27))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2353, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2356, 27))
|
||||
|
||||
declare function TestingOneThing(n: {yy: string, name: string}): JSX.Element;
|
||||
>TestingOneThing : Symbol(TestingOneThing, Decl(file.tsx, 13, 47), Decl(file.tsx, 16, 60), Decl(file.tsx, 17, 86), Decl(file.tsx, 18, 83))
|
||||
>n : Symbol(n, Decl(file.tsx, 19, 33))
|
||||
>yy : Symbol(yy, Decl(file.tsx, 19, 37))
|
||||
>name : Symbol(name, Decl(file.tsx, 19, 48))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2352, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2355, 27))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2353, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2356, 27))
|
||||
|
||||
// OK
|
||||
const d1 = <TestingOneThing y1 extra-data />;
|
||||
@@ -140,8 +140,8 @@ declare function TestingOptional(a: {y1?: string, y2?: number}): JSX.Element;
|
||||
>a : Symbol(a, Decl(file.tsx, 29, 33))
|
||||
>y1 : Symbol(y1, Decl(file.tsx, 29, 37))
|
||||
>y2 : Symbol(y2, Decl(file.tsx, 29, 49))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2352, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2355, 27))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2353, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2356, 27))
|
||||
|
||||
declare function TestingOptional(a: {y1: boolean, y2?: number, y3: boolean}): JSX.Element;
|
||||
>TestingOptional : Symbol(TestingOptional, Decl(file.tsx, 26, 72), Decl(file.tsx, 29, 77))
|
||||
@@ -149,42 +149,44 @@ declare function TestingOptional(a: {y1: boolean, y2?: number, y3: boolean}): JS
|
||||
>y1 : Symbol(y1, Decl(file.tsx, 30, 37))
|
||||
>y2 : Symbol(y2, Decl(file.tsx, 30, 49))
|
||||
>y3 : Symbol(y3, Decl(file.tsx, 30, 62))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2352, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2355, 27))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2353, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2356, 27))
|
||||
|
||||
// OK
|
||||
const e1 = <TestingOptional />
|
||||
>e1 : Symbol(e1, Decl(file.tsx, 33, 5))
|
||||
>TestingOptional : Symbol(TestingOptional, Decl(file.tsx, 26, 72), Decl(file.tsx, 29, 77))
|
||||
|
||||
const e2 = <TestingOptional extra-prop/>
|
||||
>e2 : Symbol(e2, Decl(file.tsx, 34, 5))
|
||||
>TestingOptional : Symbol(TestingOptional, Decl(file.tsx, 26, 72), Decl(file.tsx, 29, 77))
|
||||
>extra-prop : Symbol(extra-prop, Decl(file.tsx, 34, 27))
|
||||
|
||||
const e3 = <TestingOptional y1="hello"/>
|
||||
>e3 : Symbol(e3, Decl(file.tsx, 35, 5))
|
||||
>e3 : Symbol(e3, Decl(file.tsx, 34, 5))
|
||||
>TestingOptional : Symbol(TestingOptional, Decl(file.tsx, 26, 72), Decl(file.tsx, 29, 77))
|
||||
>y1 : Symbol(y1, Decl(file.tsx, 35, 27))
|
||||
>y1 : Symbol(y1, Decl(file.tsx, 34, 27))
|
||||
|
||||
const e4 = <TestingOptional y1="hello" y2={1000} />
|
||||
>e4 : Symbol(e4, Decl(file.tsx, 36, 5))
|
||||
>e4 : Symbol(e4, Decl(file.tsx, 35, 5))
|
||||
>TestingOptional : Symbol(TestingOptional, Decl(file.tsx, 26, 72), Decl(file.tsx, 29, 77))
|
||||
>y1 : Symbol(y1, Decl(file.tsx, 36, 27))
|
||||
>y2 : Symbol(y2, Decl(file.tsx, 36, 38))
|
||||
>y1 : Symbol(y1, Decl(file.tsx, 35, 27))
|
||||
>y2 : Symbol(y2, Decl(file.tsx, 35, 38))
|
||||
|
||||
const e5 = <TestingOptional y1 y3/>
|
||||
>e5 : Symbol(e5, Decl(file.tsx, 37, 5))
|
||||
>e5 : Symbol(e5, Decl(file.tsx, 36, 5))
|
||||
>TestingOptional : Symbol(TestingOptional, Decl(file.tsx, 26, 72), Decl(file.tsx, 29, 77))
|
||||
>y1 : Symbol(y1, Decl(file.tsx, 36, 27))
|
||||
>y3 : Symbol(y3, Decl(file.tsx, 36, 30))
|
||||
|
||||
const e6 = <TestingOptional y1 y3 y2={10} />
|
||||
>e6 : Symbol(e6, Decl(file.tsx, 37, 5))
|
||||
>TestingOptional : Symbol(TestingOptional, Decl(file.tsx, 26, 72), Decl(file.tsx, 29, 77))
|
||||
>y1 : Symbol(y1, Decl(file.tsx, 37, 27))
|
||||
>y3 : Symbol(y3, Decl(file.tsx, 37, 30))
|
||||
>y2 : Symbol(y2, Decl(file.tsx, 37, 33))
|
||||
|
||||
const e6 = <TestingOptional y1 y3 y2={10} />
|
||||
>e6 : Symbol(e6, Decl(file.tsx, 38, 5))
|
||||
const e2 = <TestingOptional y1 y3 extra-prop/>
|
||||
>e2 : Symbol(e2, Decl(file.tsx, 38, 5))
|
||||
>TestingOptional : Symbol(TestingOptional, Decl(file.tsx, 26, 72), Decl(file.tsx, 29, 77))
|
||||
>y1 : Symbol(y1, Decl(file.tsx, 38, 27))
|
||||
>y3 : Symbol(y3, Decl(file.tsx, 38, 30))
|
||||
>y2 : Symbol(y2, Decl(file.tsx, 38, 33))
|
||||
>extra-prop : Symbol(extra-prop, Decl(file.tsx, 38, 33))
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -171,12 +171,6 @@ const e1 = <TestingOptional />
|
||||
><TestingOptional /> : JSX.Element
|
||||
>TestingOptional : { (a: { y1?: string; y2?: number; }): JSX.Element; (a: { y1: boolean; y2?: number; y3: boolean; }): JSX.Element; }
|
||||
|
||||
const e2 = <TestingOptional extra-prop/>
|
||||
>e2 : JSX.Element
|
||||
><TestingOptional extra-prop/> : JSX.Element
|
||||
>TestingOptional : { (a: { y1?: string; y2?: number; }): JSX.Element; (a: { y1: boolean; y2?: number; y3: boolean; }): JSX.Element; }
|
||||
>extra-prop : true
|
||||
|
||||
const e3 = <TestingOptional y1="hello"/>
|
||||
>e3 : JSX.Element
|
||||
><TestingOptional y1="hello"/> : JSX.Element
|
||||
@@ -207,5 +201,13 @@ const e6 = <TestingOptional y1 y3 y2={10} />
|
||||
>y2 : number
|
||||
>10 : 10
|
||||
|
||||
const e2 = <TestingOptional y1 y3 extra-prop/>
|
||||
>e2 : JSX.Element
|
||||
><TestingOptional y1 y3 extra-prop/> : JSX.Element
|
||||
>TestingOptional : { (a: { y1?: string; y2?: number; }): JSX.Element; (a: { y1: boolean; y2?: number; y3: boolean; }): JSX.Element; }
|
||||
>y1 : true
|
||||
>y3 : true
|
||||
>extra-prop : true
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -4,16 +4,16 @@ import React = require('react')
|
||||
|
||||
declare function OneThing(): JSX.Element;
|
||||
>OneThing : Symbol(OneThing, Decl(file.tsx, 0, 31), Decl(file.tsx, 1, 41))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2352, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2355, 27))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2353, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2356, 27))
|
||||
|
||||
declare function OneThing(l: {yy: number, yy1: string}): JSX.Element;
|
||||
>OneThing : Symbol(OneThing, Decl(file.tsx, 0, 31), Decl(file.tsx, 1, 41))
|
||||
>l : Symbol(l, Decl(file.tsx, 2, 26))
|
||||
>yy : Symbol(yy, Decl(file.tsx, 2, 30))
|
||||
>yy1 : Symbol(yy1, Decl(file.tsx, 2, 41))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2352, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2355, 27))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2353, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2356, 27))
|
||||
|
||||
let obj = {
|
||||
>obj : Symbol(obj, Decl(file.tsx, 4, 3))
|
||||
|
||||
@@ -7,8 +7,8 @@ interface Context {
|
||||
}
|
||||
declare function ZeroThingOrTwoThing(): JSX.Element;
|
||||
>ZeroThingOrTwoThing : Symbol(ZeroThingOrTwoThing, Decl(file.tsx, 2, 1), Decl(file.tsx, 3, 52))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2352, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2355, 27))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2353, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2356, 27))
|
||||
|
||||
declare function ZeroThingOrTwoThing(l: {yy: number, yy1: string}, context: Context): JSX.Element;
|
||||
>ZeroThingOrTwoThing : Symbol(ZeroThingOrTwoThing, Decl(file.tsx, 2, 1), Decl(file.tsx, 3, 52))
|
||||
@@ -17,8 +17,8 @@ declare function ZeroThingOrTwoThing(l: {yy: number, yy1: string}, context: Cont
|
||||
>yy1 : Symbol(yy1, Decl(file.tsx, 4, 52))
|
||||
>context : Symbol(context, Decl(file.tsx, 4, 66))
|
||||
>Context : Symbol(Context, Decl(file.tsx, 0, 0))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2352, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2355, 27))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2353, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2356, 27))
|
||||
|
||||
let obj2: any;
|
||||
>obj2 : Symbol(obj2, Decl(file.tsx, 6, 3))
|
||||
@@ -55,15 +55,15 @@ declare function ThreeThing(l: {y1: string}): JSX.Element;
|
||||
>ThreeThing : Symbol(ThreeThing, Decl(file.tsx, 13, 58), Decl(file.tsx, 15, 58), Decl(file.tsx, 16, 58))
|
||||
>l : Symbol(l, Decl(file.tsx, 15, 28))
|
||||
>y1 : Symbol(y1, Decl(file.tsx, 15, 32))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2352, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2355, 27))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2353, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2356, 27))
|
||||
|
||||
declare function ThreeThing(l: {y2: string}): JSX.Element;
|
||||
>ThreeThing : Symbol(ThreeThing, Decl(file.tsx, 13, 58), Decl(file.tsx, 15, 58), Decl(file.tsx, 16, 58))
|
||||
>l : Symbol(l, Decl(file.tsx, 16, 28))
|
||||
>y2 : Symbol(y2, Decl(file.tsx, 16, 32))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2352, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2355, 27))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2353, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2356, 27))
|
||||
|
||||
declare function ThreeThing(l: {yy: number, yy1: string}, context: Context, updater: any): JSX.Element;
|
||||
>ThreeThing : Symbol(ThreeThing, Decl(file.tsx, 13, 58), Decl(file.tsx, 15, 58), Decl(file.tsx, 16, 58))
|
||||
@@ -73,8 +73,8 @@ declare function ThreeThing(l: {yy: number, yy1: string}, context: Context, upda
|
||||
>context : Symbol(context, Decl(file.tsx, 17, 57))
|
||||
>Context : Symbol(Context, Decl(file.tsx, 0, 0))
|
||||
>updater : Symbol(updater, Decl(file.tsx, 17, 75))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2352, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2355, 27))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2353, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2356, 27))
|
||||
|
||||
// OK
|
||||
const three1 = <ThreeThing yy={99} yy1="hello world" />;
|
||||
|
||||
@@ -19,7 +19,7 @@ export interface ButtonProps extends ClickableProps {
|
||||
onClick: React.MouseEventHandler<any>;
|
||||
>onClick : Symbol(ButtonProps.onClick, Decl(file.tsx, 7, 53))
|
||||
>React : Symbol(React, Decl(file.tsx, 0, 0))
|
||||
>MouseEventHandler : Symbol(React.MouseEventHandler, Decl(react.d.ts, 388, 66))
|
||||
>MouseEventHandler : Symbol(React.MouseEventHandler, Decl(react.d.ts, 389, 66))
|
||||
}
|
||||
|
||||
export interface LinkProps extends ClickableProps {
|
||||
@@ -60,22 +60,22 @@ export function MainButton(buttonProps: ButtonProps): JSX.Element;
|
||||
>MainButton : Symbol(MainButton, Decl(file.tsx, 26, 1), Decl(file.tsx, 28, 66), Decl(file.tsx, 29, 62), Decl(file.tsx, 30, 66))
|
||||
>buttonProps : Symbol(buttonProps, Decl(file.tsx, 28, 27))
|
||||
>ButtonProps : Symbol(ButtonProps, Decl(file.tsx, 5, 1))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2352, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2355, 27))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2353, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2356, 27))
|
||||
|
||||
export function MainButton(linkProps: LinkProps): JSX.Element;
|
||||
>MainButton : Symbol(MainButton, Decl(file.tsx, 26, 1), Decl(file.tsx, 28, 66), Decl(file.tsx, 29, 62), Decl(file.tsx, 30, 66))
|
||||
>linkProps : Symbol(linkProps, Decl(file.tsx, 29, 27))
|
||||
>LinkProps : Symbol(LinkProps, Decl(file.tsx, 9, 1))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2352, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2355, 27))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2353, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2356, 27))
|
||||
|
||||
export function MainButton(hyphenProps: HyphenProps): JSX.Element;
|
||||
>MainButton : Symbol(MainButton, Decl(file.tsx, 26, 1), Decl(file.tsx, 28, 66), Decl(file.tsx, 29, 62), Decl(file.tsx, 30, 66))
|
||||
>hyphenProps : Symbol(hyphenProps, Decl(file.tsx, 30, 27))
|
||||
>HyphenProps : Symbol(HyphenProps, Decl(file.tsx, 13, 1))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2352, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2355, 27))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2353, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2356, 27))
|
||||
|
||||
export function MainButton(props: ButtonProps | LinkProps | HyphenProps): JSX.Element {
|
||||
>MainButton : Symbol(MainButton, Decl(file.tsx, 26, 1), Decl(file.tsx, 28, 66), Decl(file.tsx, 29, 62), Decl(file.tsx, 30, 66))
|
||||
@@ -83,8 +83,8 @@ export function MainButton(props: ButtonProps | LinkProps | HyphenProps): JSX.El
|
||||
>ButtonProps : Symbol(ButtonProps, Decl(file.tsx, 5, 1))
|
||||
>LinkProps : Symbol(LinkProps, Decl(file.tsx, 9, 1))
|
||||
>HyphenProps : Symbol(HyphenProps, Decl(file.tsx, 13, 1))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2352, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2355, 27))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2353, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2356, 27))
|
||||
|
||||
const linkProps = props as LinkProps;
|
||||
>linkProps : Symbol(linkProps, Decl(file.tsx, 32, 9))
|
||||
|
||||
+2
-2
@@ -17,8 +17,8 @@ function MyComponent<T = MyComponentProp>(attr: T) {
|
||||
>T : Symbol(T, Decl(file.tsx, 6, 21))
|
||||
|
||||
return <div>attr.values</div>
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2399, 45))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2399, 45))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2400, 45))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2400, 45))
|
||||
}
|
||||
|
||||
// OK
|
||||
|
||||
@@ -5,16 +5,17 @@ tests/cases/conformance/jsx/file.tsx(27,15): error TS2322: Type '{ name: 42; }'
|
||||
Type '{ name: 42; }' is not assignable to type '{ name?: string; }'.
|
||||
Types of property 'name' are incompatible.
|
||||
Type '42' is not assignable to type 'string'.
|
||||
tests/cases/conformance/jsx/file.tsx(29,15): error TS2339: Property 'naaaaaaame' does not exist on type 'IntrinsicAttributes & { name?: string; }'.
|
||||
tests/cases/conformance/jsx/file.tsx(29,15): error TS2559: Type '{ naaaaaaame: "no"; }' has no properties in common with type 'IntrinsicAttributes & { name?: string; }'.
|
||||
tests/cases/conformance/jsx/file.tsx(34,23): error TS2322: Type '{}' is not assignable to type 'IntrinsicAttributes & { "prop-name": string; }'.
|
||||
Type '{}' is not assignable to type '{ "prop-name": string; }'.
|
||||
Property '"prop-name"' is missing in type '{}'.
|
||||
tests/cases/conformance/jsx/file.tsx(37,23): error TS2339: Property 'prop1' does not exist on type 'IntrinsicAttributes'.
|
||||
tests/cases/conformance/jsx/file.tsx(38,24): error TS2339: Property 'ref' does not exist on type 'IntrinsicAttributes'.
|
||||
tests/cases/conformance/jsx/file.tsx(37,23): error TS2559: Type '{ prop1: true; }' has no properties in common with type 'IntrinsicAttributes'.
|
||||
tests/cases/conformance/jsx/file.tsx(38,24): error TS2559: Type '{ ref: (x: any) => any; }' has no properties in common with type 'IntrinsicAttributes'.
|
||||
tests/cases/conformance/jsx/file.tsx(41,16): error TS1005: ',' expected.
|
||||
tests/cases/conformance/jsx/file.tsx(45,24): error TS2559: Type '{ prop1: boolean; }' has no properties in common with type 'IntrinsicAttributes'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/jsx/file.tsx (7 errors) ====
|
||||
==== tests/cases/conformance/jsx/file.tsx (8 errors) ====
|
||||
function EmptyPropSFC() {
|
||||
return <div> Default Greeting </div>;
|
||||
}
|
||||
@@ -54,7 +55,7 @@ tests/cases/conformance/jsx/file.tsx(41,16): error TS1005: ',' expected.
|
||||
// Error
|
||||
let f = <Meet naaaaaaame='no' />;
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! error TS2339: Property 'naaaaaaame' does not exist on type 'IntrinsicAttributes & { name?: string; }'.
|
||||
!!! error TS2559: Type '{ naaaaaaame: "no"; }' has no properties in common with type 'IntrinsicAttributes & { name?: string; }'.
|
||||
|
||||
// OK
|
||||
let g = <MeetAndGreet prop-name="Bob" />;
|
||||
@@ -68,10 +69,10 @@ tests/cases/conformance/jsx/file.tsx(41,16): error TS1005: ',' expected.
|
||||
// Error
|
||||
let i = <EmptyPropSFC prop1 />
|
||||
~~~~~
|
||||
!!! error TS2339: Property 'prop1' does not exist on type 'IntrinsicAttributes'.
|
||||
!!! error TS2559: Type '{ prop1: true; }' has no properties in common with type 'IntrinsicAttributes'.
|
||||
let i1 = <EmptyPropSFC ref={x => x.greeting.substr(10)} />
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2339: Property 'ref' does not exist on type 'IntrinsicAttributes'.
|
||||
!!! error TS2559: Type '{ ref: (x: any) => any; }' has no properties in common with type 'IntrinsicAttributes'.
|
||||
|
||||
let o = {
|
||||
prop1: true;
|
||||
@@ -81,6 +82,8 @@ tests/cases/conformance/jsx/file.tsx(41,16): error TS1005: ',' expected.
|
||||
|
||||
// OK as access properties are allow when spread
|
||||
let i2 = <EmptyPropSFC {...o} />
|
||||
~~~~~~
|
||||
!!! error TS2559: Type '{ prop1: boolean; }' has no properties in common with type 'IntrinsicAttributes'.
|
||||
|
||||
let o1: any;
|
||||
// OK
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/conformance/jsx/file.tsx(19,16): error TS2339: Property 'ref' does not exist on type 'IntrinsicAttributes & { name?: string; }'.
|
||||
tests/cases/conformance/jsx/file.tsx(19,16): error TS2559: Type '{ ref: "myRef"; }' has no properties in common with type 'IntrinsicAttributes & { name?: string; }'.
|
||||
tests/cases/conformance/jsx/file.tsx(25,42): error TS2339: Property 'subtr' does not exist on type 'string'.
|
||||
tests/cases/conformance/jsx/file.tsx(27,33): error TS2339: Property 'notARealProperty' does not exist on type 'BigGreeter'.
|
||||
tests/cases/conformance/jsx/file.tsx(35,26): error TS2339: Property 'propertyNotOnHtmlDivElement' does not exist on type 'HTMLDivElement'.
|
||||
@@ -25,7 +25,7 @@ tests/cases/conformance/jsx/file.tsx(35,26): error TS2339: Property 'propertyNot
|
||||
// Error - not allowed to specify 'ref' on SFCs
|
||||
let c = <Greet ref="myRef" />;
|
||||
~~~~~~~~~~~
|
||||
!!! error TS2339: Property 'ref' does not exist on type 'IntrinsicAttributes & { name?: string; }'.
|
||||
!!! error TS2559: Type '{ ref: "myRef"; }' has no properties in common with type 'IntrinsicAttributes & { name?: string; }'.
|
||||
|
||||
|
||||
// OK - ref is valid for classes
|
||||
|
||||
@@ -5,7 +5,7 @@ import React = require('react');
|
||||
const Foo = (props: any) => <div/>;
|
||||
>Foo : Symbol(Foo, Decl(file.tsx, 2, 5))
|
||||
>props : Symbol(props, Decl(file.tsx, 2, 13))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2399, 45))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2400, 45))
|
||||
|
||||
// Should be OK
|
||||
const foo = <Foo />;
|
||||
@@ -17,31 +17,31 @@ const foo = <Foo />;
|
||||
var MainMenu: React.StatelessComponent<{}> = (props) => (<div>
|
||||
>MainMenu : Symbol(MainMenu, Decl(file.tsx, 8, 3))
|
||||
>React : Symbol(React, Decl(file.tsx, 0, 0))
|
||||
>StatelessComponent : Symbol(React.StatelessComponent, Decl(react.d.ts, 197, 40))
|
||||
>StatelessComponent : Symbol(React.StatelessComponent, Decl(react.d.ts, 198, 40))
|
||||
>props : Symbol(props, Decl(file.tsx, 8, 46))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2399, 45))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2400, 45))
|
||||
|
||||
<h3>Main Menu</h3>
|
||||
>h3 : Symbol(JSX.IntrinsicElements.h3, Decl(react.d.ts, 2411, 48))
|
||||
>h3 : Symbol(JSX.IntrinsicElements.h3, Decl(react.d.ts, 2411, 48))
|
||||
>h3 : Symbol(JSX.IntrinsicElements.h3, Decl(react.d.ts, 2412, 48))
|
||||
>h3 : Symbol(JSX.IntrinsicElements.h3, Decl(react.d.ts, 2412, 48))
|
||||
|
||||
</div>);
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2399, 45))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2400, 45))
|
||||
|
||||
var App: React.StatelessComponent<{ children }> = ({children}) => (
|
||||
>App : Symbol(App, Decl(file.tsx, 12, 3))
|
||||
>React : Symbol(React, Decl(file.tsx, 0, 0))
|
||||
>StatelessComponent : Symbol(React.StatelessComponent, Decl(react.d.ts, 197, 40))
|
||||
>StatelessComponent : Symbol(React.StatelessComponent, Decl(react.d.ts, 198, 40))
|
||||
>children : Symbol(children, Decl(file.tsx, 12, 35))
|
||||
>children : Symbol(children, Decl(file.tsx, 12, 52))
|
||||
|
||||
<div >
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2399, 45))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2400, 45))
|
||||
|
||||
<MainMenu/>
|
||||
>MainMenu : Symbol(MainMenu, Decl(file.tsx, 8, 3))
|
||||
|
||||
</div>
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2399, 45))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2400, 45))
|
||||
|
||||
);
|
||||
|
||||
@@ -11,8 +11,8 @@ declare function ComponentWithTwoAttributes<K,V>(l: {key1: K, value: V}): JSX.El
|
||||
>K : Symbol(K, Decl(file.tsx, 2, 44))
|
||||
>value : Symbol(value, Decl(file.tsx, 2, 61))
|
||||
>V : Symbol(V, Decl(file.tsx, 2, 46))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2352, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2355, 27))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2353, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2356, 27))
|
||||
|
||||
// OK
|
||||
function Baz<T,U>(key1: T, value: U) {
|
||||
@@ -48,8 +48,8 @@ declare function Link<U>(l: {func: (arg: U)=>void}): JSX.Element;
|
||||
>func : Symbol(func, Decl(file.tsx, 10, 29))
|
||||
>arg : Symbol(arg, Decl(file.tsx, 10, 36))
|
||||
>U : Symbol(U, Decl(file.tsx, 10, 22))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2352, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2355, 27))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2353, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2356, 27))
|
||||
|
||||
// OK
|
||||
function createLink(func: (a: number)=>void) {
|
||||
@@ -97,8 +97,8 @@ declare function InferParamComponent<T>(attr: InferParamProp<T>): JSX.Element;
|
||||
>attr : Symbol(attr, Decl(file.tsx, 26, 40))
|
||||
>InferParamProp : Symbol(InferParamProp, Decl(file.tsx, 19, 1))
|
||||
>T : Symbol(T, Decl(file.tsx, 26, 37))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2352, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2355, 27))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2353, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2356, 27))
|
||||
|
||||
// OK
|
||||
let i = <InferParamComponent values={[1, 2, 3, 4]} selectHandler={(val) => { }} />;
|
||||
|
||||
+10
-10
@@ -5,8 +5,8 @@ import React = require('react')
|
||||
declare function OverloadComponent<U>(): JSX.Element;
|
||||
>OverloadComponent : Symbol(OverloadComponent, Decl(file.tsx, 0, 31), Decl(file.tsx, 2, 53), Decl(file.tsx, 3, 101))
|
||||
>U : Symbol(U, Decl(file.tsx, 2, 35))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2352, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2355, 27))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2353, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2356, 27))
|
||||
|
||||
declare function OverloadComponent<U>(attr: {b: U, a?: string, "ignore-prop": boolean}): JSX.Element;
|
||||
>OverloadComponent : Symbol(OverloadComponent, Decl(file.tsx, 0, 31), Decl(file.tsx, 2, 53), Decl(file.tsx, 3, 101))
|
||||
@@ -15,8 +15,8 @@ declare function OverloadComponent<U>(attr: {b: U, a?: string, "ignore-prop": bo
|
||||
>b : Symbol(b, Decl(file.tsx, 3, 45))
|
||||
>U : Symbol(U, Decl(file.tsx, 3, 35))
|
||||
>a : Symbol(a, Decl(file.tsx, 3, 50))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2352, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2355, 27))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2353, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2356, 27))
|
||||
|
||||
declare function OverloadComponent<T, U>(attr: {b: U, a: T}): JSX.Element;
|
||||
>OverloadComponent : Symbol(OverloadComponent, Decl(file.tsx, 0, 31), Decl(file.tsx, 2, 53), Decl(file.tsx, 3, 101))
|
||||
@@ -27,8 +27,8 @@ declare function OverloadComponent<T, U>(attr: {b: U, a: T}): JSX.Element;
|
||||
>U : Symbol(U, Decl(file.tsx, 4, 37))
|
||||
>a : Symbol(a, Decl(file.tsx, 4, 53))
|
||||
>T : Symbol(T, Decl(file.tsx, 4, 35))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2352, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2355, 27))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2353, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2356, 27))
|
||||
|
||||
// OK
|
||||
function Baz<T extends {b: number}, U extends {a: boolean, b:string}>(arg1: T, arg2: U) {
|
||||
@@ -93,8 +93,8 @@ declare function Link<U>(l: {func: (arg: U)=>void}): JSX.Element;
|
||||
>func : Symbol(func, Decl(file.tsx, 17, 29))
|
||||
>arg : Symbol(arg, Decl(file.tsx, 17, 36))
|
||||
>U : Symbol(U, Decl(file.tsx, 17, 22))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2352, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2355, 27))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2353, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2356, 27))
|
||||
|
||||
declare function Link<U>(l: {func: (arg1:U, arg2: string)=>void}): JSX.Element;
|
||||
>Link : Symbol(Link, Decl(file.tsx, 15, 1), Decl(file.tsx, 17, 65))
|
||||
@@ -104,8 +104,8 @@ declare function Link<U>(l: {func: (arg1:U, arg2: string)=>void}): JSX.Element;
|
||||
>arg1 : Symbol(arg1, Decl(file.tsx, 18, 36))
|
||||
>U : Symbol(U, Decl(file.tsx, 18, 22))
|
||||
>arg2 : Symbol(arg2, Decl(file.tsx, 18, 43))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2352, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2355, 27))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2353, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2356, 27))
|
||||
|
||||
function createLink(func: (a: number)=>void) {
|
||||
>createLink : Symbol(createLink, Decl(file.tsx, 18, 79))
|
||||
|
||||
+6
-6
@@ -4,9 +4,9 @@ tests/cases/conformance/jsx/file.tsx(9,33): error TS2322: Type '{ a: number; }'
|
||||
tests/cases/conformance/jsx/file.tsx(10,33): error TS2322: Type 'T' is not assignable to type 'IntrinsicAttributes & { b: number; a: {}; }'.
|
||||
Type '{ b: number; }' is not assignable to type 'IntrinsicAttributes & { b: number; a: {}; }'.
|
||||
Type '{ b: number; }' is not assignable to type '{ b: number; a: {}; }'.
|
||||
Type 'T' is not assignable to type '{ b: number; a: {}; }'.
|
||||
Type '{ b: number; }' is not assignable to type '{ b: number; a: {}; }'.
|
||||
Property 'a' is missing in type '{ b: number; }'.
|
||||
Property 'a' is missing in type '{ b: number; }'.
|
||||
Type 'T' is not assignable to type 'IntrinsicAttributes'.
|
||||
Type '{ b: number; }' has no properties in common with type 'IntrinsicAttributes'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/jsx/file.tsx (2 errors) ====
|
||||
@@ -28,7 +28,7 @@ tests/cases/conformance/jsx/file.tsx(10,33): error TS2322: Type 'T' is not assig
|
||||
!!! error TS2322: Type 'T' is not assignable to type 'IntrinsicAttributes & { b: number; a: {}; }'.
|
||||
!!! error TS2322: Type '{ b: number; }' is not assignable to type 'IntrinsicAttributes & { b: number; a: {}; }'.
|
||||
!!! error TS2322: Type '{ b: number; }' is not assignable to type '{ b: number; a: {}; }'.
|
||||
!!! error TS2322: Type 'T' is not assignable to type '{ b: number; a: {}; }'.
|
||||
!!! error TS2322: Type '{ b: number; }' is not assignable to type '{ b: number; a: {}; }'.
|
||||
!!! error TS2322: Property 'a' is missing in type '{ b: number; }'.
|
||||
!!! error TS2322: Property 'a' is missing in type '{ b: number; }'.
|
||||
!!! error TS2322: Type 'T' is not assignable to type 'IntrinsicAttributes'.
|
||||
!!! error TS2322: Type '{ b: number; }' has no properties in common with type 'IntrinsicAttributes'.
|
||||
}
|
||||
@@ -8,8 +8,8 @@ function SFC1(prop: { x: number }) {
|
||||
>x : Symbol(x, Decl(file.tsx, 2, 21))
|
||||
|
||||
return <div>hello</div>;
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2399, 45))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2399, 45))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2400, 45))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2400, 45))
|
||||
|
||||
};
|
||||
|
||||
@@ -19,8 +19,8 @@ function SFC2(prop: { x: boolean }) {
|
||||
>x : Symbol(x, Decl(file.tsx, 6, 21))
|
||||
|
||||
return <h1>World </h1>;
|
||||
>h1 : Symbol(JSX.IntrinsicElements.h1, Decl(react.d.ts, 2409, 47))
|
||||
>h1 : Symbol(JSX.IntrinsicElements.h1, Decl(react.d.ts, 2409, 47))
|
||||
>h1 : Symbol(JSX.IntrinsicElements.h1, Decl(react.d.ts, 2410, 47))
|
||||
>h1 : Symbol(JSX.IntrinsicElements.h1, Decl(react.d.ts, 2410, 47))
|
||||
}
|
||||
|
||||
var SFCComp = SFC1 || SFC2;
|
||||
|
||||
@@ -4,9 +4,9 @@ import React = require('react');
|
||||
|
||||
class RC1 extends React.Component<{x : number}, {}> {
|
||||
>RC1 : Symbol(RC1, Decl(file.tsx, 0, 32))
|
||||
>React.Component : Symbol(React.Component, Decl(react.d.ts, 158, 55))
|
||||
>React.Component : Symbol(React.Component, Decl(react.d.ts, 158, 55), Decl(react.d.ts, 161, 66))
|
||||
>React : Symbol(React, Decl(file.tsx, 0, 0))
|
||||
>Component : Symbol(React.Component, Decl(react.d.ts, 158, 55))
|
||||
>Component : Symbol(React.Component, Decl(react.d.ts, 158, 55), Decl(react.d.ts, 161, 66))
|
||||
>x : Symbol(x, Decl(file.tsx, 2, 35))
|
||||
|
||||
render() {
|
||||
@@ -18,9 +18,9 @@ class RC1 extends React.Component<{x : number}, {}> {
|
||||
|
||||
class RC2 extends React.Component<{ x: string }, {}> {
|
||||
>RC2 : Symbol(RC2, Decl(file.tsx, 6, 1))
|
||||
>React.Component : Symbol(React.Component, Decl(react.d.ts, 158, 55))
|
||||
>React.Component : Symbol(React.Component, Decl(react.d.ts, 158, 55), Decl(react.d.ts, 161, 66))
|
||||
>React : Symbol(React, Decl(file.tsx, 0, 0))
|
||||
>Component : Symbol(React.Component, Decl(react.d.ts, 158, 55))
|
||||
>Component : Symbol(React.Component, Decl(react.d.ts, 158, 55), Decl(react.d.ts, 161, 66))
|
||||
>x : Symbol(x, Decl(file.tsx, 8, 35))
|
||||
|
||||
render() {
|
||||
@@ -34,9 +34,9 @@ class RC2 extends React.Component<{ x: string }, {}> {
|
||||
|
||||
class RC3 extends React.Component<{}, {}> {
|
||||
>RC3 : Symbol(RC3, Decl(file.tsx, 13, 1))
|
||||
>React.Component : Symbol(React.Component, Decl(react.d.ts, 158, 55))
|
||||
>React.Component : Symbol(React.Component, Decl(react.d.ts, 158, 55), Decl(react.d.ts, 161, 66))
|
||||
>React : Symbol(React, Decl(file.tsx, 0, 0))
|
||||
>Component : Symbol(React.Component, Decl(react.d.ts, 158, 55))
|
||||
>Component : Symbol(React.Component, Decl(react.d.ts, 158, 55), Decl(react.d.ts, 161, 66))
|
||||
|
||||
render() {
|
||||
>render : Symbol(RC3.render, Decl(file.tsx, 15, 43))
|
||||
@@ -47,9 +47,9 @@ class RC3 extends React.Component<{}, {}> {
|
||||
|
||||
class RC4 extends React.Component<{}, {}> {
|
||||
>RC4 : Symbol(RC4, Decl(file.tsx, 19, 1))
|
||||
>React.Component : Symbol(React.Component, Decl(react.d.ts, 158, 55))
|
||||
>React.Component : Symbol(React.Component, Decl(react.d.ts, 158, 55), Decl(react.d.ts, 161, 66))
|
||||
>React : Symbol(React, Decl(file.tsx, 0, 0))
|
||||
>Component : Symbol(React.Component, Decl(react.d.ts, 158, 55))
|
||||
>Component : Symbol(React.Component, Decl(react.d.ts, 158, 55), Decl(react.d.ts, 161, 66))
|
||||
|
||||
render() {
|
||||
>render : Symbol(RC4.render, Decl(file.tsx, 21, 43))
|
||||
|
||||
@@ -3,8 +3,8 @@ tests/cases/conformance/jsx/file.tsx(32,17): error TS2322: Type '{ x: true; }' i
|
||||
Type '{ x: true; }' is not assignable to type '{ x: string; }'.
|
||||
Types of property 'x' are incompatible.
|
||||
Type 'true' is not assignable to type 'string'.
|
||||
tests/cases/conformance/jsx/file.tsx(33,21): error TS2339: Property 'x' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<RC4> & { children?: ReactNode; }'.
|
||||
tests/cases/conformance/jsx/file.tsx(34,22): error TS2339: Property 'prop' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<RC3> & { children?: ReactNode; }'.
|
||||
tests/cases/conformance/jsx/file.tsx(33,21): error TS2559: Type '{ x: 10; }' has no properties in common with type 'IntrinsicAttributes & IntrinsicClassAttributes<RC4> & { children?: ReactNode; }'.
|
||||
tests/cases/conformance/jsx/file.tsx(34,22): error TS2559: Type '{ prop: true; }' has no properties in common with type 'IntrinsicAttributes & IntrinsicClassAttributes<RC3> & { children?: ReactNode; }'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/jsx/file.tsx (3 errors) ====
|
||||
@@ -48,8 +48,8 @@ tests/cases/conformance/jsx/file.tsx(34,22): error TS2339: Property 'prop' does
|
||||
!!! error TS2322: Type 'true' is not assignable to type 'string'.
|
||||
let b = <PartRCComp x={10} />
|
||||
~~~~~~
|
||||
!!! error TS2339: Property 'x' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<RC4> & { children?: ReactNode; }'.
|
||||
!!! error TS2559: Type '{ x: 10; }' has no properties in common with type 'IntrinsicAttributes & IntrinsicClassAttributes<RC4> & { children?: ReactNode; }'.
|
||||
let c = <EmptyRCComp prop />;
|
||||
~~~~
|
||||
!!! error TS2339: Property 'prop' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<RC3> & { children?: ReactNode; }'.
|
||||
!!! error TS2559: Type '{ prop: true; }' has no properties in common with type 'IntrinsicAttributes & IntrinsicClassAttributes<RC3> & { children?: ReactNode; }'.
|
||||
|
||||
@@ -6,16 +6,16 @@ function EmptySFC1() {
|
||||
>EmptySFC1 : Symbol(EmptySFC1, Decl(file.tsx, 0, 32))
|
||||
|
||||
return <div>hello</div>;
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2399, 45))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2399, 45))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2400, 45))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2400, 45))
|
||||
}
|
||||
|
||||
function EmptySFC2() {
|
||||
>EmptySFC2 : Symbol(EmptySFC2, Decl(file.tsx, 4, 1))
|
||||
|
||||
return <div>Hello</div>;
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2399, 45))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2399, 45))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2400, 45))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2400, 45))
|
||||
}
|
||||
|
||||
function SFC2(prop: { x: boolean }) {
|
||||
@@ -24,8 +24,8 @@ function SFC2(prop: { x: boolean }) {
|
||||
>x : Symbol(x, Decl(file.tsx, 10, 21))
|
||||
|
||||
return <h1>World</h1>;
|
||||
>h1 : Symbol(JSX.IntrinsicElements.h1, Decl(react.d.ts, 2409, 47))
|
||||
>h1 : Symbol(JSX.IntrinsicElements.h1, Decl(react.d.ts, 2409, 47))
|
||||
>h1 : Symbol(JSX.IntrinsicElements.h1, Decl(react.d.ts, 2410, 47))
|
||||
>h1 : Symbol(JSX.IntrinsicElements.h1, Decl(react.d.ts, 2410, 47))
|
||||
}
|
||||
|
||||
var EmptySFCComp = EmptySFC1 || EmptySFC2;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/conformance/jsx/file.tsx(18,23): error TS2339: Property 'x' does not exist on type 'IntrinsicAttributes'.
|
||||
tests/cases/conformance/jsx/file.tsx(18,23): error TS2559: Type '{ x: true; }' has no properties in common with type 'IntrinsicAttributes'.
|
||||
tests/cases/conformance/jsx/file.tsx(19,27): error TS2322: Type '{ x: "hi"; }' is not assignable to type 'IntrinsicAttributes & { x: boolean; }'.
|
||||
Type '{ x: "hi"; }' is not assignable to type '{ x: boolean; }'.
|
||||
Types of property 'x' are incompatible.
|
||||
@@ -31,7 +31,7 @@ tests/cases/conformance/jsx/file.tsx(21,27): error TS2322: Type '{}' is not assi
|
||||
// Error
|
||||
let a = <EmptySFCComp x />;
|
||||
~
|
||||
!!! error TS2339: Property 'x' does not exist on type 'IntrinsicAttributes'.
|
||||
!!! error TS2559: Type '{ x: true; }' has no properties in common with type 'IntrinsicAttributes'.
|
||||
let b = <SFC2AndEmptyComp x="hi" />;
|
||||
~~~~~~
|
||||
!!! error TS2322: Type '{ x: "hi"; }' is not assignable to type 'IntrinsicAttributes & { x: boolean; }'.
|
||||
|
||||
@@ -8,16 +8,16 @@ interface ComponentProps {
|
||||
AnyComponent: React.StatelessComponent<any> | React.ComponentClass<any>;
|
||||
>AnyComponent : Symbol(ComponentProps.AnyComponent, Decl(file.tsx, 2, 26))
|
||||
>React : Symbol(React, Decl(file.tsx, 0, 0))
|
||||
>StatelessComponent : Symbol(React.StatelessComponent, Decl(react.d.ts, 197, 40))
|
||||
>StatelessComponent : Symbol(React.StatelessComponent, Decl(react.d.ts, 198, 40))
|
||||
>React : Symbol(React, Decl(file.tsx, 0, 0))
|
||||
>ComponentClass : Symbol(React.ComponentClass, Decl(react.d.ts, 204, 5))
|
||||
>ComponentClass : Symbol(React.ComponentClass, Decl(react.d.ts, 205, 5))
|
||||
}
|
||||
|
||||
class MyComponent extends React.Component<ComponentProps, {}> {
|
||||
>MyComponent : Symbol(MyComponent, Decl(file.tsx, 4, 1))
|
||||
>React.Component : Symbol(React.Component, Decl(react.d.ts, 158, 55))
|
||||
>React.Component : Symbol(React.Component, Decl(react.d.ts, 158, 55), Decl(react.d.ts, 161, 66))
|
||||
>React : Symbol(React, Decl(file.tsx, 0, 0))
|
||||
>Component : Symbol(React.Component, Decl(react.d.ts, 158, 55))
|
||||
>Component : Symbol(React.Component, Decl(react.d.ts, 158, 55), Decl(react.d.ts, 161, 66))
|
||||
>ComponentProps : Symbol(ComponentProps, Decl(file.tsx, 0, 32))
|
||||
|
||||
render() {
|
||||
@@ -25,9 +25,9 @@ class MyComponent extends React.Component<ComponentProps, {}> {
|
||||
|
||||
const { AnyComponent } = this.props;
|
||||
>AnyComponent : Symbol(AnyComponent, Decl(file.tsx, 8, 15))
|
||||
>this.props : Symbol(React.Component.props, Decl(react.d.ts, 166, 37))
|
||||
>this.props : Symbol(React.Component.props, Decl(react.d.ts, 167, 37))
|
||||
>this : Symbol(MyComponent, Decl(file.tsx, 4, 1))
|
||||
>props : Symbol(React.Component.props, Decl(react.d.ts, 166, 37))
|
||||
>props : Symbol(React.Component.props, Decl(react.d.ts, 167, 37))
|
||||
|
||||
return (<AnyComponent />);
|
||||
>AnyComponent : Symbol(AnyComponent, Decl(file.tsx, 8, 15))
|
||||
@@ -38,15 +38,15 @@ class MyComponent extends React.Component<ComponentProps, {}> {
|
||||
<MyComponent AnyComponent={() => <button>test</button>}/>
|
||||
>MyComponent : Symbol(MyComponent, Decl(file.tsx, 4, 1))
|
||||
>AnyComponent : Symbol(AnyComponent, Decl(file.tsx, 14, 12))
|
||||
>button : Symbol(JSX.IntrinsicElements.button, Decl(react.d.ts, 2385, 43))
|
||||
>button : Symbol(JSX.IntrinsicElements.button, Decl(react.d.ts, 2385, 43))
|
||||
>button : Symbol(JSX.IntrinsicElements.button, Decl(react.d.ts, 2386, 43))
|
||||
>button : Symbol(JSX.IntrinsicElements.button, Decl(react.d.ts, 2386, 43))
|
||||
|
||||
// Component Class as Props
|
||||
class MyButtonComponent extends React.Component<{},{}> {
|
||||
>MyButtonComponent : Symbol(MyButtonComponent, Decl(file.tsx, 14, 57))
|
||||
>React.Component : Symbol(React.Component, Decl(react.d.ts, 158, 55))
|
||||
>React.Component : Symbol(React.Component, Decl(react.d.ts, 158, 55), Decl(react.d.ts, 161, 66))
|
||||
>React : Symbol(React, Decl(file.tsx, 0, 0))
|
||||
>Component : Symbol(React.Component, Decl(react.d.ts, 158, 55))
|
||||
>Component : Symbol(React.Component, Decl(react.d.ts, 158, 55), Decl(react.d.ts, 161, 66))
|
||||
}
|
||||
|
||||
<MyComponent AnyComponent={MyButtonComponent} />
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
tests/cases/compiler/weakType.ts(31,18): error TS2559: Type '{ error?: number; }' has no properties in common with type 'ChangeOptions'.
|
||||
tests/cases/compiler/weakType.ts(56,5): error TS2322: Type '{ properties: { wrong: string; }; }' is not assignable to type 'Weak & Spoiler'.
|
||||
Type '{ properties: { wrong: string; }; }' is not assignable to type 'Weak'.
|
||||
Types of property 'properties' are incompatible.
|
||||
Type '{ wrong: string; }' has no properties in common with type '{ b?: number; }'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/weakType.ts (2 errors) ====
|
||||
interface Settings {
|
||||
timeout?: number;
|
||||
onError?(): void;
|
||||
}
|
||||
|
||||
function getDefaultSettings() {
|
||||
return { timeout: 1000 };
|
||||
}
|
||||
|
||||
function doSomething(settings: Settings) { /* ... */ }
|
||||
|
||||
// forgot to call `getDefaultSettings`
|
||||
// but it is not caught because we don't check for call signatures
|
||||
doSomething(getDefaultSettings);
|
||||
|
||||
// this is an oddly popular way of defining settings
|
||||
// this example is from services/textChanges.ts
|
||||
type ConfigurableStart = { useStart?: boolean }
|
||||
type ConfigurableEnd = { useEnd?: boolean }
|
||||
type ConfigurableStartEnd = ConfigurableStart & ConfigurableEnd
|
||||
interface InsertOptions {
|
||||
prefix?: string
|
||||
suffix?: string
|
||||
}
|
||||
type ChangeOptions = ConfigurableStartEnd & InsertOptions;
|
||||
|
||||
function del(options: ConfigurableStartEnd = {},
|
||||
error: { error?: number } = {}) {
|
||||
let changes: ChangeOptions[];
|
||||
changes.push(options);
|
||||
changes.push(error);
|
||||
~~~~~
|
||||
!!! error TS2559: Type '{ error?: number; }' has no properties in common with type 'ChangeOptions'.
|
||||
}
|
||||
|
||||
class K {
|
||||
constructor(s: string) { }
|
||||
}
|
||||
// Ctor isn't a weak type because it has a construct signature
|
||||
interface Ctor {
|
||||
new (s: string): K
|
||||
n?: number
|
||||
}
|
||||
let ctor: Ctor = K
|
||||
|
||||
type Spoiler = { nope?: string }
|
||||
type Weak = {
|
||||
a?: number
|
||||
properties?: {
|
||||
b?: number
|
||||
}
|
||||
}
|
||||
declare let unknown: {
|
||||
properties: {
|
||||
wrong: string
|
||||
}
|
||||
}
|
||||
let weak: Weak & Spoiler = unknown
|
||||
~~~~
|
||||
!!! error TS2322: Type '{ properties: { wrong: string; }; }' is not assignable to type 'Weak & Spoiler'.
|
||||
!!! error TS2322: Type '{ properties: { wrong: string; }; }' is not assignable to type 'Weak'.
|
||||
!!! error TS2322: Types of property 'properties' are incompatible.
|
||||
!!! error TS2322: Type '{ wrong: string; }' has no properties in common with type '{ b?: number; }'.
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
//// [weakType.ts]
|
||||
interface Settings {
|
||||
timeout?: number;
|
||||
onError?(): void;
|
||||
}
|
||||
|
||||
function getDefaultSettings() {
|
||||
return { timeout: 1000 };
|
||||
}
|
||||
|
||||
function doSomething(settings: Settings) { /* ... */ }
|
||||
|
||||
// forgot to call `getDefaultSettings`
|
||||
// but it is not caught because we don't check for call signatures
|
||||
doSomething(getDefaultSettings);
|
||||
|
||||
// this is an oddly popular way of defining settings
|
||||
// this example is from services/textChanges.ts
|
||||
type ConfigurableStart = { useStart?: boolean }
|
||||
type ConfigurableEnd = { useEnd?: boolean }
|
||||
type ConfigurableStartEnd = ConfigurableStart & ConfigurableEnd
|
||||
interface InsertOptions {
|
||||
prefix?: string
|
||||
suffix?: string
|
||||
}
|
||||
type ChangeOptions = ConfigurableStartEnd & InsertOptions;
|
||||
|
||||
function del(options: ConfigurableStartEnd = {},
|
||||
error: { error?: number } = {}) {
|
||||
let changes: ChangeOptions[];
|
||||
changes.push(options);
|
||||
changes.push(error);
|
||||
}
|
||||
|
||||
class K {
|
||||
constructor(s: string) { }
|
||||
}
|
||||
// Ctor isn't a weak type because it has a construct signature
|
||||
interface Ctor {
|
||||
new (s: string): K
|
||||
n?: number
|
||||
}
|
||||
let ctor: Ctor = K
|
||||
|
||||
type Spoiler = { nope?: string }
|
||||
type Weak = {
|
||||
a?: number
|
||||
properties?: {
|
||||
b?: number
|
||||
}
|
||||
}
|
||||
declare let unknown: {
|
||||
properties: {
|
||||
wrong: string
|
||||
}
|
||||
}
|
||||
let weak: Weak & Spoiler = unknown
|
||||
|
||||
|
||||
//// [weakType.js]
|
||||
function getDefaultSettings() {
|
||||
return { timeout: 1000 };
|
||||
}
|
||||
function doSomething(settings) { }
|
||||
// forgot to call `getDefaultSettings`
|
||||
// but it is not caught because we don't check for call signatures
|
||||
doSomething(getDefaultSettings);
|
||||
function del(options, error) {
|
||||
if (options === void 0) { options = {}; }
|
||||
if (error === void 0) { error = {}; }
|
||||
var changes;
|
||||
changes.push(options);
|
||||
changes.push(error);
|
||||
}
|
||||
var K = (function () {
|
||||
function K(s) {
|
||||
}
|
||||
return K;
|
||||
}());
|
||||
var ctor = K;
|
||||
var weak = unknown;
|
||||
@@ -15,7 +15,7 @@ declare var fs: {
|
||||
existsSync(path: string): boolean;
|
||||
readdirSync(path: string): string[];
|
||||
readFileSync(filename: string, encoding?: string): string;
|
||||
writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: number; flag?: string; }): void;
|
||||
writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: number; flag?: string; } | string): void;
|
||||
watchFile(filename: string, options: { persistent?: boolean; interval?: number; }, listener: (curr: { mtime: Date }, prev: { mtime: Date }) => void): void;
|
||||
};
|
||||
declare var path: any;
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
interface Settings {
|
||||
timeout?: number;
|
||||
onError?(): void;
|
||||
}
|
||||
|
||||
function getDefaultSettings() {
|
||||
return { timeout: 1000 };
|
||||
}
|
||||
|
||||
function doSomething(settings: Settings) { /* ... */ }
|
||||
|
||||
// forgot to call `getDefaultSettings`
|
||||
// but it is not caught because we don't check for call signatures
|
||||
doSomething(getDefaultSettings);
|
||||
|
||||
// this is an oddly popular way of defining settings
|
||||
// this example is from services/textChanges.ts
|
||||
type ConfigurableStart = { useStart?: boolean }
|
||||
type ConfigurableEnd = { useEnd?: boolean }
|
||||
type ConfigurableStartEnd = ConfigurableStart & ConfigurableEnd
|
||||
interface InsertOptions {
|
||||
prefix?: string
|
||||
suffix?: string
|
||||
}
|
||||
type ChangeOptions = ConfigurableStartEnd & InsertOptions;
|
||||
|
||||
function del(options: ConfigurableStartEnd = {},
|
||||
error: { error?: number } = {}) {
|
||||
let changes: ChangeOptions[];
|
||||
changes.push(options);
|
||||
changes.push(error);
|
||||
}
|
||||
|
||||
class K {
|
||||
constructor(s: string) { }
|
||||
}
|
||||
// Ctor isn't a weak type because it has a construct signature
|
||||
interface Ctor {
|
||||
new (s: string): K
|
||||
n?: number
|
||||
}
|
||||
let ctor: Ctor = K
|
||||
|
||||
type Spoiler = { nope?: string }
|
||||
type Weak = {
|
||||
a?: number
|
||||
properties?: {
|
||||
b?: number
|
||||
}
|
||||
}
|
||||
declare let unknown: {
|
||||
properties: {
|
||||
wrong: string
|
||||
}
|
||||
}
|
||||
let weak: Weak & Spoiler = unknown
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
import React = require('react');
|
||||
|
||||
export function makeP<P>(Ctor: React.ComponentClass<P>): React.ComponentClass<P> {
|
||||
export function makeP<P>(Ctor: React.ComponentClass<P>) {
|
||||
return class extends React.PureComponent<P, void> {
|
||||
public render(): JSX.Element {
|
||||
return (
|
||||
@@ -13,4 +13,5 @@ export function makeP<P>(Ctor: React.ComponentClass<P>): React.ComponentClass<P>
|
||||
);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -38,10 +38,10 @@ declare function TestingOptional(a: {y1: boolean, y2?: number, y3: boolean}): JS
|
||||
|
||||
// OK
|
||||
const e1 = <TestingOptional />
|
||||
const e2 = <TestingOptional extra-prop/>
|
||||
const e3 = <TestingOptional y1="hello"/>
|
||||
const e4 = <TestingOptional y1="hello" y2={1000} />
|
||||
const e5 = <TestingOptional y1 y3/>
|
||||
const e6 = <TestingOptional y1 y3 y2={10} />
|
||||
const e2 = <TestingOptional y1 y3 extra-prop/>
|
||||
|
||||
|
||||
|
||||
+6
-6
@@ -29,20 +29,20 @@ module TargetHasOptional {
|
||||
var e: E;
|
||||
var f: F;
|
||||
|
||||
// all ok
|
||||
// disallowed by weak type checking
|
||||
c = d;
|
||||
c = e;
|
||||
c = f;
|
||||
c = a;
|
||||
|
||||
a = d;
|
||||
a = e;
|
||||
a = f;
|
||||
a = c;
|
||||
|
||||
b = d;
|
||||
b = e;
|
||||
b = f;
|
||||
|
||||
// ok
|
||||
c = a;
|
||||
a = c;
|
||||
b = a;
|
||||
b = c;
|
||||
}
|
||||
@@ -86,4 +86,4 @@ module SourceHasOptional {
|
||||
b = f; // error
|
||||
b = a; // ok
|
||||
b = c; // ok
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -41,7 +41,7 @@ module Optional {
|
||||
}
|
||||
|
||||
class B implements A {
|
||||
fooo: Derived; // ok
|
||||
fooo: Derived; // weak type error
|
||||
}
|
||||
|
||||
interface A2 {
|
||||
@@ -49,7 +49,7 @@ module Optional {
|
||||
}
|
||||
|
||||
class B2 implements A2 {
|
||||
2: Derived; // ok
|
||||
2: Derived; // weak type error
|
||||
}
|
||||
|
||||
interface A3 {
|
||||
@@ -57,6 +57,6 @@ module Optional {
|
||||
}
|
||||
|
||||
class B3 implements A3 {
|
||||
'1.0': Derived; // ok
|
||||
'1.0': Derived; // weak type error
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+2
-1
@@ -159,7 +159,8 @@ declare namespace __React {
|
||||
type ReactInstance = Component<any, any> | Element;
|
||||
|
||||
// Base component for plain JS classes
|
||||
class Component<P, S> implements ComponentLifecycle<P, S> {
|
||||
interface Component<P, S> extends ComponentLifecycle<P, S> { }
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user