Compare commits

...

11 commits

Author SHA1 Message Date
Anders Hejlsberg 7247d8e33a T extends unknown ? X : Y should eagerly resolve to X 2018-05-25 10:03:42 -07:00
Anders Hejlsberg ac6fa9ccee Fix fourslash test 2018-05-25 09:49:20 -07:00
Anders Hejlsberg 8666d39c59 Accept new baselines 2018-05-25 09:46:20 -07:00
Anders Hejlsberg 3f5f8d7bd6 Fix issue 2018-05-25 09:45:53 -07:00
Anders Hejlsberg 77bb4f89c0 Accept new baselines 2018-05-25 09:10:17 -07:00
Anders Hejlsberg 0d9dc89a78 Proper handling of top type in intersection types 2018-05-25 09:03:30 -07:00
Anders Hejlsberg 4c417833a9 Use ObjectFlags.EmptyObjectType in addTypeToIntersection 2018-05-24 13:13:01 -07:00
Anders Hejlsberg 2a19a4d81d Use ObjectFlags.EmptyObjectType to check for empty object types 2018-05-24 13:00:40 -07:00
Anders Hejlsberg 1148cb0039 Accept baseline API changes 2018-05-24 12:59:45 -07:00
Anders Hejlsberg 9e362b949e Accept new baselines 2018-05-24 12:49:20 -07:00
Anders Hejlsberg bac117d64d Empty object type in a union type absorbs all but null and undefined 2018-05-24 12:36:44 -07:00
51 changed files with 247 additions and 244 deletions

View file

@ -372,11 +372,10 @@ namespace ts {
const stringNumberSymbolType = getUnionType([stringType, numberType, esSymbolType]); const stringNumberSymbolType = getUnionType([stringType, numberType, esSymbolType]);
const keyofConstraintType = keyofStringsOnly ? stringType : stringNumberSymbolType; const keyofConstraintType = keyofStringsOnly ? stringType : stringNumberSymbolType;
const emptyObjectType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined);
const emptyTypeLiteralSymbol = createSymbol(SymbolFlags.TypeLiteral, InternalSymbolName.Type); const emptyTypeLiteralSymbol = createSymbol(SymbolFlags.TypeLiteral, InternalSymbolName.Type);
emptyTypeLiteralSymbol.members = createSymbolTable(); emptyTypeLiteralSymbol.members = createSymbolTable();
const emptyTypeLiteralType = createAnonymousType(emptyTypeLiteralSymbol, emptySymbols, emptyArray, emptyArray, undefined, undefined); const emptyObjectType = createAnonymousType(emptyTypeLiteralSymbol, emptySymbols, emptyArray, emptyArray, undefined, undefined);
emptyObjectType.objectFlags |= ObjectFlags.EmptyObjectType;
const emptyGenericType = <GenericType><ObjectType>createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); const emptyGenericType = <GenericType><ObjectType>createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined);
emptyGenericType.instantiations = createMap<TypeReference>(); emptyGenericType.instantiations = createMap<TypeReference>();
@ -448,6 +447,7 @@ namespace ts {
let deferredGlobalTemplateStringsArrayType: ObjectType; let deferredGlobalTemplateStringsArrayType: ObjectType;
let deferredGlobalImportMetaType: ObjectType; let deferredGlobalImportMetaType: ObjectType;
let deferredGlobalExtractSymbol: Symbol; let deferredGlobalExtractSymbol: Symbol;
let deferredTopType: Type;
let deferredNodes: Node[] | undefined; let deferredNodes: Node[] | undefined;
const allPotentiallyUnusedIdentifiers = createMap<PotentiallyUnusedIdentifier[]>(); // key is file name const allPotentiallyUnusedIdentifiers = createMap<PotentiallyUnusedIdentifier[]>(); // key is file name
@ -8299,6 +8299,9 @@ namespace ts {
else if (!strictNullChecks && flags & TypeFlags.Nullable) { else if (!strictNullChecks && flags & TypeFlags.Nullable) {
if (!(flags & TypeFlags.ContainsWideningType)) includes |= TypeFlags.NonWideningType; if (!(flags & TypeFlags.ContainsWideningType)) includes |= TypeFlags.NonWideningType;
} }
else if (getObjectFlags(type) & ObjectFlags.EmptyObjectType) {
includes |= TypeFlags.EmptyObject;
}
else { else {
const len = typeSet.length; const len = typeSet.length;
const index = len && type.id > typeSet[len - 1].id ? ~len : binarySearch(typeSet, type, getTypeId, compareValues); const index = len && type.id > typeSet[len - 1].id ? ~len : binarySearch(typeSet, type, getTypeId, compareValues);
@ -8402,20 +8405,30 @@ namespace ts {
if (types.length === 1) { if (types.length === 1) {
return types[0]; return types[0];
} }
const typeSet: Type[] = []; let typeSet: Type[] = [];
const includes = addTypesToUnion(typeSet, 0, types); const includes = addTypesToUnion(typeSet, 0, types);
if (includes & TypeFlags.Any) { if (includes & TypeFlags.Any) {
return includes & TypeFlags.Wildcard ? wildcardType : anyType; return includes & TypeFlags.Wildcard ? wildcardType : anyType;
} }
switch (unionReduction) { if (includes & TypeFlags.EmptyObject) {
case UnionReduction.Literal: if (!(strictNullChecks && includes & TypeFlags.Nullable)) {
if (includes & TypeFlags.StringOrNumberLiteralOrUnique) { return emptyObjectType;
removeRedundantLiteralTypes(typeSet, includes); }
} typeSet = !(includes & TypeFlags.Undefined) ? [nullType, emptyObjectType] :
break; !(includes & TypeFlags.Null) ? [undefinedType, emptyObjectType] :
case UnionReduction.Subtype: [undefinedType, nullType, emptyObjectType];
removeSubtypes(typeSet); }
break; else {
switch (unionReduction) {
case UnionReduction.Literal:
if (includes & TypeFlags.StringOrNumberLiteralOrUnique) {
removeRedundantLiteralTypes(typeSet, includes);
}
break;
case UnionReduction.Subtype:
removeSubtypes(typeSet);
break;
}
} }
if (typeSet.length === 0) { if (typeSet.length === 0) {
return includes & TypeFlags.Null ? includes & TypeFlags.NonWideningType ? nullType : nullWideningType : return includes & TypeFlags.Null ? includes & TypeFlags.NonWideningType ? nullType : nullWideningType :
@ -8498,6 +8511,10 @@ namespace ts {
return links.resolvedType; return links.resolvedType;
} }
function getTopType() {
return deferredTopType || (deferredTopType = getUnionType([emptyObjectType, nullType, undefinedType]));
}
function addTypeToIntersection(typeSet: Type[], includes: TypeFlags, type: Type) { function addTypeToIntersection(typeSet: Type[], includes: TypeFlags, type: Type) {
const flags = type.flags; const flags = type.flags;
if (flags & TypeFlags.Intersection) { if (flags & TypeFlags.Intersection) {
@ -8506,6 +8523,9 @@ namespace ts {
if (getObjectFlags(type) & ObjectFlags.Anonymous && isEmptyObjectType(type)) { if (getObjectFlags(type) & ObjectFlags.Anonymous && isEmptyObjectType(type)) {
includes |= TypeFlags.EmptyObject; includes |= TypeFlags.EmptyObject;
} }
else if (type.flags & TypeFlags.Union && type === getTopType()) {
includes |= TypeFlags.TopUnion;
}
else { else {
includes |= flags & ~TypeFlags.ConstructionFlags; includes |= flags & ~TypeFlags.ConstructionFlags;
if (flags & TypeFlags.Any) { if (flags & TypeFlags.Any) {
@ -8579,9 +8599,6 @@ namespace ts {
// Also, unlike union types, the order of the constituent types is preserved in order that overload resolution // Also, unlike union types, the order of the constituent types is preserved in order that overload resolution
// for intersections of types with signatures can be deterministic. // for intersections of types with signatures can be deterministic.
function getIntersectionType(types: Type[], aliasSymbol?: Symbol, aliasTypeArguments?: Type[]): Type { function getIntersectionType(types: Type[], aliasSymbol?: Symbol, aliasTypeArguments?: Type[]): Type {
if (types.length === 0) {
return emptyObjectType;
}
const typeSet: Type[] = []; const typeSet: Type[] = [];
const includes = addTypesToIntersection(typeSet, 0, types); const includes = addTypesToIntersection(typeSet, 0, types);
if (includes & TypeFlags.Never) { if (includes & TypeFlags.Never) {
@ -8590,12 +8607,18 @@ namespace ts {
if (includes & TypeFlags.Any) { if (includes & TypeFlags.Any) {
return includes & TypeFlags.Wildcard ? wildcardType : anyType; return includes & TypeFlags.Wildcard ? wildcardType : anyType;
} }
if (!strictNullChecks && includes & TypeFlags.Nullable) {
return includes & TypeFlags.Undefined ? undefinedType : nullType;
}
if (typeSet.length === 0) {
return includes & TypeFlags.TopUnion ? getTopType() : emptyObjectType;
}
if (includes & TypeFlags.String && includes & TypeFlags.StringLiteral || if (includes & TypeFlags.String && includes & TypeFlags.StringLiteral ||
includes & TypeFlags.Number && includes & TypeFlags.NumberLiteral || includes & TypeFlags.Number && includes & TypeFlags.NumberLiteral ||
includes & TypeFlags.ESSymbol && includes & TypeFlags.UniqueESSymbol) { includes & TypeFlags.ESSymbol && includes & TypeFlags.UniqueESSymbol) {
removeRedundantPrimitiveTypes(typeSet, includes); removeRedundantPrimitiveTypes(typeSet, includes);
} }
if (includes & TypeFlags.EmptyObject && !(includes & TypeFlags.Object)) { if (includes & TypeFlags.EmptyObject && !(includes & TypeFlags.Object) && includes & TypeFlags.Nullable) {
typeSet.push(emptyObjectType); typeSet.push(emptyObjectType);
} }
if (typeSet.length === 1) { if (typeSet.length === 1) {
@ -8961,6 +8984,9 @@ namespace ts {
if (checkType === wildcardType || extendsType === wildcardType) { if (checkType === wildcardType || extendsType === wildcardType) {
return wildcardType; return wildcardType;
} }
if (extendsType === getTopType()) {
return instantiateType(root.trueType, mapper);
}
// If this is a distributive conditional type and the check type is generic we need to defer // If this is a distributive conditional type and the check type is generic we need to defer
// resolution of the conditional type such that a later instantiation will properly distribute // resolution of the conditional type such that a later instantiation will properly distribute
// over union types. // over union types.
@ -9162,11 +9188,12 @@ namespace ts {
if (!links.resolvedType) { if (!links.resolvedType) {
// Deferred resolution of members is handled by resolveObjectTypeMembers // Deferred resolution of members is handled by resolveObjectTypeMembers
const aliasSymbol = getAliasSymbolForTypeNode(node); const aliasSymbol = getAliasSymbolForTypeNode(node);
if (getMembersOfSymbol(node.symbol).size === 0 && !aliasSymbol) { const isEmptyObjectLiteral = getMembersOfSymbol(node.symbol).size === 0;
links.resolvedType = emptyTypeLiteralType; if (isEmptyObjectLiteral && !aliasSymbol) {
links.resolvedType = emptyObjectType;
} }
else { else {
let type = createObjectType(ObjectFlags.Anonymous, node.symbol); let type = createObjectType(ObjectFlags.Anonymous | (isEmptyObjectLiteral ? ObjectFlags.EmptyObjectType : 0), node.symbol);
type.aliasSymbol = aliasSymbol; type.aliasSymbol = aliasSymbol;
type.aliasTypeArguments = getTypeArgumentsForAliasSymbol(aliasSymbol); type.aliasTypeArguments = getTypeArgumentsForAliasSymbol(aliasSymbol);
if (isJSDocTypeLiteral(node) && node.isArrayType) { if (isJSDocTypeLiteral(node) && node.isArrayType) {
@ -9215,7 +9242,7 @@ namespace ts {
const skippedPrivateMembers = createUnderscoreEscapedMap<boolean>(); const skippedPrivateMembers = createUnderscoreEscapedMap<boolean>();
let stringIndexInfo: IndexInfo | undefined; let stringIndexInfo: IndexInfo | undefined;
let numberIndexInfo: IndexInfo | undefined; let numberIndexInfo: IndexInfo | undefined;
if (left === emptyObjectType) { if (getObjectFlags(left) & ObjectFlags.EmptyObjectType) {
// for the first spread element, left === emptyObjectType, so take the right's string indexer // for the first spread element, left === emptyObjectType, so take the right's string indexer
stringIndexInfo = getIndexInfoOfType(right, IndexKind.String); stringIndexInfo = getIndexInfoOfType(right, IndexKind.String);
numberIndexInfo = getIndexInfoOfType(right, IndexKind.Number); numberIndexInfo = getIndexInfoOfType(right, IndexKind.Number);
@ -12888,7 +12915,9 @@ namespace ts {
const constraint = getConstraintOfTypeParameter(inference.typeParameter); const constraint = getConstraintOfTypeParameter(inference.typeParameter);
if (constraint) { if (constraint) {
const instantiatedConstraint = instantiateType(constraint, context); const instantiatedConstraint = instantiateType(constraint, context);
if (!context.compareTypes(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) { // If the inferred type is an empty object type we go with the constraint since it may
// be more, but never less, specific (e.g. an object type with only optional properties).
if (getObjectFlags(inferredType) & ObjectFlags.EmptyObjectType || !context.compareTypes(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) {
inference.inferredType = inferredType = instantiatedConstraint; inference.inferredType = inferredType = instantiatedConstraint;
} }
} }
@ -16233,7 +16262,7 @@ namespace ts {
if (typeToIntersect && spread !== emptyObjectType) { if (typeToIntersect && spread !== emptyObjectType) {
return getIntersectionType([typeToIntersect, spread]); return getIntersectionType([typeToIntersect, spread]);
} }
return typeToIntersect || (spread === emptyObjectType ? createJsxAttributesType() : spread); return typeToIntersect || (getObjectFlags(spread) & ObjectFlags.EmptyObjectType ? createJsxAttributesType() : spread);
/** /**
* Create anonymous type from given attributes symbol table. * Create anonymous type from given attributes symbol table.
@ -19387,7 +19416,7 @@ namespace ts {
const decl = parameter.valueDeclaration as ParameterDeclaration; const decl = parameter.valueDeclaration as ParameterDeclaration;
if (decl.name.kind !== SyntaxKind.Identifier) { if (decl.name.kind !== SyntaxKind.Identifier) {
// if inference didn't come up with anything but {}, fall back to the binding pattern if present. // if inference didn't come up with anything but {}, fall back to the binding pattern if present.
if (links.type === emptyObjectType) { if (getObjectFlags(links.type) & ObjectFlags.EmptyObjectType) {
links.type = getTypeFromBindingPattern(decl.name); links.type = getTypeFromBindingPattern(decl.name);
} }
assignBindingElementTypes(decl.name); assignBindingElementTypes(decl.name);
@ -19409,7 +19438,7 @@ namespace ts {
function createPromiseReturnType(func: FunctionLikeDeclaration | ImportCall, promisedType: Type) { function createPromiseReturnType(func: FunctionLikeDeclaration | ImportCall, promisedType: Type) {
const promiseType = createPromiseType(promisedType); const promiseType = createPromiseType(promisedType);
if (promiseType === emptyObjectType) { if (getObjectFlags(promiseType) & ObjectFlags.EmptyObjectType) {
error(func, isImportCall(func) ? error(func, isImportCall(func) ?
Diagnostics.A_dynamic_import_call_returns_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option : Diagnostics.A_dynamic_import_call_returns_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option :
Diagnostics.An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option); Diagnostics.An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option);

View file

@ -3687,17 +3687,17 @@ namespace ts {
IndexedAccess = 1 << 20, // T[K] IndexedAccess = 1 << 20, // T[K]
Conditional = 1 << 21, // T extends U ? X : Y Conditional = 1 << 21, // T extends U ? X : Y
Substitution = 1 << 22, // Type parameter substitution Substitution = 1 << 22, // Type parameter substitution
NonPrimitive = 1 << 23, // intrinsic object type
/* @internal */ /* @internal */
FreshLiteral = 1 << 23, // Fresh literal or unique type FreshLiteral = 1 << 24, // Fresh literal or unique type
/* @internal */ /* @internal */
ContainsWideningType = 1 << 24, // Type is or contains undefined or null widening type UnionOfUnitTypes = 1 << 25, // Type is union of unit types
/* @internal */ /* @internal */
ContainsObjectLiteral = 1 << 25, // Type is or contains object literal type ContainsWideningType = 1 << 26, // Type is or contains undefined or null widening type
/* @internal */ /* @internal */
ContainsAnyFunctionType = 1 << 26, // Type is or contains the anyFunctionType ContainsObjectLiteral = 1 << 27, // Type is or contains object literal type
NonPrimitive = 1 << 27, // intrinsic object type
/* @internal */ /* @internal */
UnionOfUnitTypes = 1 << 28, // Type is union of unit types ContainsAnyFunctionType = 1 << 28, // Type is or contains the anyFunctionType
/* @internal */ /* @internal */
GenericMappedType = 1 << 29, // Flag used by maybeTypeOfKind GenericMappedType = 1 << 29, // Flag used by maybeTypeOfKind
@ -3749,7 +3749,9 @@ namespace ts {
/* @internal */ /* @internal */
EmptyObject = ContainsAnyFunctionType, EmptyObject = ContainsAnyFunctionType,
/* @internal */ /* @internal */
ConstructionFlags = NonWideningType | Wildcard | EmptyObject TopUnion = GenericMappedType,
/* @internal */
ConstructionFlags = NonWideningType | Wildcard | EmptyObject | GenericMappedType
} }
export type DestructuringPattern = BindingPattern | ObjectLiteralExpression | ArrayLiteralExpression; export type DestructuringPattern = BindingPattern | ObjectLiteralExpression | ArrayLiteralExpression;
@ -3813,6 +3815,7 @@ namespace ts {
ReverseMapped = 1 << 11, // Object contains a property from a reverse-mapped type ReverseMapped = 1 << 11, // Object contains a property from a reverse-mapped type
JsxAttributes = 1 << 12, // Jsx attributes type JsxAttributes = 1 << 12, // Jsx attributes type
MarkerType = 1 << 13, // Marker type used for variance probing MarkerType = 1 << 13, // Marker type used for variance probing
EmptyObjectType = 1 << 14, // Type is known to be empty object type {}
ClassOrInterface = Class | Interface ClassOrInterface = Class | Interface
} }

View file

@ -2150,7 +2150,7 @@ declare namespace ts {
IndexedAccess = 1048576, IndexedAccess = 1048576,
Conditional = 2097152, Conditional = 2097152,
Substitution = 4194304, Substitution = 4194304,
NonPrimitive = 134217728, NonPrimitive = 8388608,
Literal = 224, Literal = 224,
Unit = 13536, Unit = 13536,
StringOrNumberLiteral = 96, StringOrNumberLiteral = 96,
@ -2168,8 +2168,8 @@ declare namespace ts {
InstantiablePrimitive = 524288, InstantiablePrimitive = 524288,
Instantiable = 7897088, Instantiable = 7897088,
StructuredOrInstantiable = 8355840, StructuredOrInstantiable = 8355840,
Narrowable = 142575359, Narrowable = 16746239,
NotUnionOrUnit = 134283777 NotUnionOrUnit = 8454657
} }
type DestructuringPattern = BindingPattern | ObjectLiteralExpression | ArrayLiteralExpression; type DestructuringPattern = BindingPattern | ObjectLiteralExpression | ArrayLiteralExpression;
interface Type { interface Type {
@ -2210,6 +2210,7 @@ declare namespace ts {
ReverseMapped = 2048, ReverseMapped = 2048,
JsxAttributes = 4096, JsxAttributes = 4096,
MarkerType = 8192, MarkerType = 8192,
EmptyObjectType = 16384,
ClassOrInterface = 3 ClassOrInterface = 3
} }
interface ObjectType extends Type { interface ObjectType extends Type {

View file

@ -2150,7 +2150,7 @@ declare namespace ts {
IndexedAccess = 1048576, IndexedAccess = 1048576,
Conditional = 2097152, Conditional = 2097152,
Substitution = 4194304, Substitution = 4194304,
NonPrimitive = 134217728, NonPrimitive = 8388608,
Literal = 224, Literal = 224,
Unit = 13536, Unit = 13536,
StringOrNumberLiteral = 96, StringOrNumberLiteral = 96,
@ -2168,8 +2168,8 @@ declare namespace ts {
InstantiablePrimitive = 524288, InstantiablePrimitive = 524288,
Instantiable = 7897088, Instantiable = 7897088,
StructuredOrInstantiable = 8355840, StructuredOrInstantiable = 8355840,
Narrowable = 142575359, Narrowable = 16746239,
NotUnionOrUnit = 134283777 NotUnionOrUnit = 8454657
} }
type DestructuringPattern = BindingPattern | ObjectLiteralExpression | ArrayLiteralExpression; type DestructuringPattern = BindingPattern | ObjectLiteralExpression | ArrayLiteralExpression;
interface Type { interface Type {
@ -2210,6 +2210,7 @@ declare namespace ts {
ReverseMapped = 2048, ReverseMapped = 2048,
JsxAttributes = 4096, JsxAttributes = 4096,
MarkerType = 8192, MarkerType = 8192,
EmptyObjectType = 16384,
ClassOrInterface = 3 ClassOrInterface = 3
} }
interface ObjectType extends Type { interface ObjectType extends Type {

View file

@ -23,7 +23,7 @@ interface IAsyncEnumerator<T> {
>AsyncEnumeratorDone : AsyncEnumeratorDone >AsyncEnumeratorDone : AsyncEnumeratorDone
next3(): Promise<T | {}>; next3(): Promise<T | {}>;
>next3 : () => Promise<{} | T> >next3 : () => Promise<{}>
>Promise : Promise<T> >Promise : Promise<T>
>T : T >T : T
@ -59,12 +59,12 @@ async function main() {
>next2 : () => Promise<AsyncEnumeratorDone> | Promise<number> >next2 : () => Promise<AsyncEnumeratorDone> | Promise<number>
let c = await x.next3(); let c = await x.next3();
>c : number | {} >c : {}
>await x.next3() : number | {} >await x.next3() : {}
>x.next3() : Promise<number | {}> >x.next3() : Promise<{}>
>x.next3 : () => Promise<number | {}> >x.next3 : () => Promise<{}>
>x : IAsyncEnumerator<number> >x : IAsyncEnumerator<number>
>next3 : () => Promise<number | {}> >next3 : () => Promise<{}>
let d = await x.next4(); let d = await x.next4();
>d : number | { x: string; } >d : number | { x: string; }

View file

@ -35,18 +35,18 @@ class Button extends React.Component<ButtonProp, any> {
return <InnerButton {...this.props} /> return <InnerButton {...this.props} />
><InnerButton {...this.props} /> : JSX.Element ><InnerButton {...this.props} /> : JSX.Element
>InnerButton : typeof InnerButton >InnerButton : typeof InnerButton
>this.props : ButtonProp & { children?: React.ReactNode; } >this.props : ButtonProp & { children?: {}; }
>this : this >this : this
>props : ButtonProp & { children?: React.ReactNode; } >props : ButtonProp & { children?: {}; }
} }
else { else {
return (<InnerButton {...this.props} > return (<InnerButton {...this.props} >
>(<InnerButton {...this.props} > <div>Hello World</div> </InnerButton>) : JSX.Element >(<InnerButton {...this.props} > <div>Hello World</div> </InnerButton>) : JSX.Element
><InnerButton {...this.props} > <div>Hello World</div> </InnerButton> : JSX.Element ><InnerButton {...this.props} > <div>Hello World</div> </InnerButton> : JSX.Element
>InnerButton : typeof InnerButton >InnerButton : typeof InnerButton
>this.props : ButtonProp & { children?: React.ReactNode; } >this.props : ButtonProp & { children?: {}; }
>this : this >this : this
>props : ButtonProp & { children?: React.ReactNode; } >props : ButtonProp & { children?: {}; }
<div>Hello World</div> <div>Hello World</div>
><div>Hello World</div> : JSX.Element ><div>Hello World</div> : JSX.Element

View file

@ -31,9 +31,9 @@ class Button extends React.Component<ButtonProp, any> {
>(<InnerButton {...this.props} children="hi"> <div>Hello World</div> </InnerButton>) : JSX.Element >(<InnerButton {...this.props} children="hi"> <div>Hello World</div> </InnerButton>) : JSX.Element
><InnerButton {...this.props} children="hi"> <div>Hello World</div> </InnerButton> : JSX.Element ><InnerButton {...this.props} children="hi"> <div>Hello World</div> </InnerButton> : JSX.Element
>InnerButton : typeof InnerButton >InnerButton : typeof InnerButton
>this.props : ButtonProp & { children?: React.ReactNode; } >this.props : ButtonProp & { children?: {}; }
>this : this >this : this
>props : ButtonProp & { children?: React.ReactNode; } >props : ButtonProp & { children?: {}; }
>children : string >children : string
<div>Hello World</div> <div>Hello World</div>

View file

@ -38,11 +38,11 @@ class FetchUser extends React.Component<IFetchUserProps, any> {
? this.props.children(this.state.result) ? this.props.children(this.state.result)
>this.props.children(this.state.result) : JSX.Element >this.props.children(this.state.result) : JSX.Element
>this.props.children : ((user: IUser) => JSX.Element) | (((user: IUser) => JSX.Element) & string) | (((user: IUser) => JSX.Element) & number) | (((user: IUser) => JSX.Element) & true) | (((user: IUser) => JSX.Element) & false) | (((user: IUser) => JSX.Element) & React.ReactElement<any>) | (((user: IUser) => JSX.Element) & (string | number | boolean | any[] | React.ReactElement<any>)[]) >this.props.children : (user: IUser) => JSX.Element
>this.props : IFetchUserProps & { children?: React.ReactNode; } >this.props : IFetchUserProps & { children?: {}; }
>this : this >this : this
>props : IFetchUserProps & { children?: React.ReactNode; } >props : IFetchUserProps & { children?: {}; }
>children : ((user: IUser) => JSX.Element) | (((user: IUser) => JSX.Element) & string) | (((user: IUser) => JSX.Element) & number) | (((user: IUser) => JSX.Element) & true) | (((user: IUser) => JSX.Element) & false) | (((user: IUser) => JSX.Element) & React.ReactElement<any>) | (((user: IUser) => JSX.Element) & (string | number | boolean | any[] | React.ReactElement<any>)[]) >children : (user: IUser) => JSX.Element
>this.state.result : any >this.state.result : any
>this.state : any >this.state : any
>this : this >this : this

View file

@ -1,5 +1,5 @@
tests/cases/conformance/jsx/file.tsx(24,28): error TS2551: Property 'NAme' does not exist on type 'IUser'. Did you mean 'Name'? tests/cases/conformance/jsx/file.tsx(24,28): error TS2551: Property 'NAme' does not exist on type 'IUser'. Did you mean 'Name'?
tests/cases/conformance/jsx/file.tsx(32,10): error TS2322: Type '{ children: ((user: IUser) => Element)[]; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<FetchUser> & IFetchUserProps & { children?: ReactNode; }'. tests/cases/conformance/jsx/file.tsx(32,10): error TS2322: Type '{ children: ((user: IUser) => Element)[]; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<FetchUser> & IFetchUserProps & { children?: {}; }'.
Type '{ children: ((user: IUser) => Element)[]; }' is not assignable to type 'IFetchUserProps'. Type '{ children: ((user: IUser) => Element)[]; }' is not assignable to type 'IFetchUserProps'.
Types of property 'children' are incompatible. Types of property 'children' are incompatible.
Type '((user: IUser) => Element)[]' is not assignable to type '(user: IUser) => Element'. Type '((user: IUser) => Element)[]' is not assignable to type '(user: IUser) => Element'.
@ -42,7 +42,7 @@ tests/cases/conformance/jsx/file.tsx(32,10): error TS2322: Type '{ children: ((u
return ( return (
<FetchUser> <FetchUser>
~~~~~~~~~ ~~~~~~~~~
!!! error TS2322: Type '{ children: ((user: IUser) => Element)[]; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<FetchUser> & IFetchUserProps & { children?: ReactNode; }'. !!! error TS2322: Type '{ children: ((user: IUser) => Element)[]; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<FetchUser> & IFetchUserProps & { children?: {}; }'.
!!! error TS2322: Type '{ children: ((user: IUser) => Element)[]; }' is not assignable to type 'IFetchUserProps'. !!! error TS2322: Type '{ children: ((user: IUser) => Element)[]; }' is not assignable to type 'IFetchUserProps'.
!!! error TS2322: Types of property 'children' are incompatible. !!! error TS2322: Types of property 'children' are incompatible.
!!! error TS2322: Type '((user: IUser) => Element)[]' is not assignable to type '(user: IUser) => Element'. !!! error TS2322: Type '((user: IUser) => Element)[]' is not assignable to type '(user: IUser) => Element'.

View file

@ -38,11 +38,11 @@ class FetchUser extends React.Component<IFetchUserProps, any> {
? this.props.children(this.state.result) ? this.props.children(this.state.result)
>this.props.children(this.state.result) : JSX.Element >this.props.children(this.state.result) : JSX.Element
>this.props.children : ((user: IUser) => JSX.Element) | (((user: IUser) => JSX.Element) & string) | (((user: IUser) => JSX.Element) & number) | (((user: IUser) => JSX.Element) & true) | (((user: IUser) => JSX.Element) & false) | (((user: IUser) => JSX.Element) & React.ReactElement<any>) | (((user: IUser) => JSX.Element) & (string | number | boolean | any[] | React.ReactElement<any>)[]) >this.props.children : (user: IUser) => JSX.Element
>this.props : IFetchUserProps & { children?: React.ReactNode; } >this.props : IFetchUserProps & { children?: {}; }
>this : this >this : this
>props : IFetchUserProps & { children?: React.ReactNode; } >props : IFetchUserProps & { children?: {}; }
>children : ((user: IUser) => JSX.Element) | (((user: IUser) => JSX.Element) & string) | (((user: IUser) => JSX.Element) & number) | (((user: IUser) => JSX.Element) & true) | (((user: IUser) => JSX.Element) & false) | (((user: IUser) => JSX.Element) & React.ReactElement<any>) | (((user: IUser) => JSX.Element) & (string | number | boolean | any[] | React.ReactElement<any>)[]) >children : (user: IUser) => JSX.Element
>this.state.result : any >this.state.result : any
>this.state : any >this.state : any
>this : this >this : this

View file

@ -0,0 +1,16 @@
tests/cases/conformance/controlFlow/controlFlowWithTemplateLiterals.ts(8,7): error TS2339: Property 'test' does not exist on type 'never'.
==== tests/cases/conformance/controlFlow/controlFlowWithTemplateLiterals.ts (1 errors) ====
declare const envVar: string | undefined;
if (typeof envVar === `string`) {
envVar.slice(0)
}
declare const obj: {test: string} | {}
if (`test` in obj) {
obj.test.slice(0)
~~~~
!!! error TS2339: Property 'test' does not exist on type 'never'.
}

View file

@ -19,10 +19,6 @@ if (`test` in obj) {
>obj : Symbol(obj, Decl(controlFlowWithTemplateLiterals.ts, 5, 13)) >obj : Symbol(obj, Decl(controlFlowWithTemplateLiterals.ts, 5, 13))
obj.test.slice(0) obj.test.slice(0)
>obj.test.slice : Symbol(String.slice, Decl(lib.d.ts, --, --))
>obj.test : Symbol(test, Decl(controlFlowWithTemplateLiterals.ts, 5, 20))
>obj : Symbol(obj, Decl(controlFlowWithTemplateLiterals.ts, 5, 13)) >obj : Symbol(obj, Decl(controlFlowWithTemplateLiterals.ts, 5, 13))
>test : Symbol(test, Decl(controlFlowWithTemplateLiterals.ts, 5, 20))
>slice : Symbol(String.slice, Decl(lib.d.ts, --, --))
} }

View file

@ -17,21 +17,21 @@ if (typeof envVar === `string`) {
} }
declare const obj: {test: string} | {} declare const obj: {test: string} | {}
>obj : {} | { test: string; } >obj : {}
>test : string >test : string
if (`test` in obj) { if (`test` in obj) {
>`test` in obj : boolean >`test` in obj : boolean
>`test` : "test" >`test` : "test"
>obj : {} | { test: string; } >obj : {}
obj.test.slice(0) obj.test.slice(0)
>obj.test.slice(0) : string >obj.test.slice(0) : any
>obj.test.slice : (start?: number | undefined, end?: number | undefined) => string >obj.test.slice : any
>obj.test : string >obj.test : any
>obj : { test: string; } >obj : never
>test : string >test : any
>slice : (start?: number | undefined, end?: number | undefined) => string >slice : any
>0 : 0 >0 : 0
} }

View file

@ -3,11 +3,11 @@ const x = new Promise( ( resolve, reject ) => { resolve( {} ); } );
>x : Promise<{}> >x : Promise<{}>
>new Promise( ( resolve, reject ) => { resolve( {} ); } ) : Promise<{}> >new Promise( ( resolve, reject ) => { resolve( {} ); } ) : Promise<{}>
>Promise : PromiseConstructor >Promise : PromiseConstructor
>( resolve, reject ) => { resolve( {} ); } : (resolve: (value?: {} | PromiseLike<{}>) => void, reject: (reason?: any) => void) => void >( resolve, reject ) => { resolve( {} ); } : (resolve: (value?: {}) => void, reject: (reason?: any) => void) => void
>resolve : (value?: {} | PromiseLike<{}>) => void >resolve : (value?: {}) => void
>reject : (reason?: any) => void >reject : (reason?: any) => void
>resolve( {} ) : void >resolve( {} ) : void
>resolve : (value?: {} | PromiseLike<{}>) => void >resolve : (value?: {}) => void
>{} : {} >{} : {}
export default x; export default x;

View file

@ -3,11 +3,11 @@ const x = new Promise( ( resolve, reject ) => { resolve( {} ); } );
>x : Promise<{}> >x : Promise<{}>
>new Promise( ( resolve, reject ) => { resolve( {} ); } ) : Promise<{}> >new Promise( ( resolve, reject ) => { resolve( {} ); } ) : Promise<{}>
>Promise : PromiseConstructor >Promise : PromiseConstructor
>( resolve, reject ) => { resolve( {} ); } : (resolve: (value?: {} | PromiseLike<{}>) => void, reject: (reason?: any) => void) => void >( resolve, reject ) => { resolve( {} ); } : (resolve: (value?: {}) => void, reject: (reason?: any) => void) => void
>resolve : (value?: {} | PromiseLike<{}>) => void >resolve : (value?: {}) => void
>reject : (reason?: any) => void >reject : (reason?: any) => void
>resolve( {} ) : void >resolve( {} ) : void
>resolve : (value?: {} | PromiseLike<{}>) => void >resolve : (value?: {}) => void
>{} : {} >{} : {}
export default x; export default x;

View file

@ -2,7 +2,7 @@ tests/cases/conformance/es6/destructuring/destructuringObjectBindingPatternAndAs
tests/cases/conformance/es6/destructuring/destructuringObjectBindingPatternAndAssignment3.ts(3,5): error TS2322: Type '{ i: number; }' is not assignable to type 'string | number'. tests/cases/conformance/es6/destructuring/destructuringObjectBindingPatternAndAssignment3.ts(3,5): error TS2322: Type '{ i: number; }' is not assignable to type 'string | number'.
Type '{ i: number; }' is not assignable to type 'number'. Type '{ i: number; }' is not assignable to type 'number'.
tests/cases/conformance/es6/destructuring/destructuringObjectBindingPatternAndAssignment3.ts(3,6): error TS2459: Type 'string | number' has no property 'i' and no string index signature. tests/cases/conformance/es6/destructuring/destructuringObjectBindingPatternAndAssignment3.ts(3,6): error TS2459: Type 'string | number' has no property 'i' and no string index signature.
tests/cases/conformance/es6/destructuring/destructuringObjectBindingPatternAndAssignment3.ts(4,6): error TS2459: Type 'string | number | {}' has no property 'i1' and no string index signature. tests/cases/conformance/es6/destructuring/destructuringObjectBindingPatternAndAssignment3.ts(4,6): error TS2459: Type '{}' has no property 'i1' and no string index signature.
tests/cases/conformance/es6/destructuring/destructuringObjectBindingPatternAndAssignment3.ts(5,12): error TS2525: Initializer provides no value for this binding element and the binding element has no default value. tests/cases/conformance/es6/destructuring/destructuringObjectBindingPatternAndAssignment3.ts(5,12): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
tests/cases/conformance/es6/destructuring/destructuringObjectBindingPatternAndAssignment3.ts(5,21): error TS2353: Object literal may only specify known properties, and 'f212' does not exist in type '{ f21: any; }'. tests/cases/conformance/es6/destructuring/destructuringObjectBindingPatternAndAssignment3.ts(5,21): error TS2353: Object literal may only specify known properties, and 'f212' does not exist in type '{ f21: any; }'.
tests/cases/conformance/es6/destructuring/destructuringObjectBindingPatternAndAssignment3.ts(6,7): error TS1005: ':' expected. tests/cases/conformance/es6/destructuring/destructuringObjectBindingPatternAndAssignment3.ts(6,7): error TS1005: ':' expected.
@ -23,7 +23,7 @@ tests/cases/conformance/es6/destructuring/destructuringObjectBindingPatternAndAs
!!! error TS2459: Type 'string | number' has no property 'i' and no string index signature. !!! error TS2459: Type 'string | number' has no property 'i' and no string index signature.
var {i1}: string | number| {} = { i1: 2 }; var {i1}: string | number| {} = { i1: 2 };
~~ ~~
!!! error TS2459: Type 'string | number | {}' has no property 'i1' and no string index signature. !!! error TS2459: Type '{}' has no property 'i1' and no string index signature.
var { f2: {f21} = { f212: "string" } }: any = undefined; var { f2: {f21} = { f212: "string" } }: any = undefined;
~~~ ~~~
!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value. !!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value.

View file

@ -9,7 +9,7 @@ class A<T extends Object>{
>T : T >T : T
} }
var a = new A(); var a = new A();
>a : A<{}> >a : A<Object>
>new A() : A<{}> >new A() : A<Object>
>A : typeof A >A : typeof A

View file

@ -24,14 +24,14 @@ var r = foo(1); // ok
>1 : 1 >1 : 1
var r2 = foo(null); // {} var r2 = foo(null); // {}
>r2 : {} >r2 : any
>foo(null) : {} >foo(null) : any
>foo : <T, U extends T>(t: T) => U >foo : <T, U extends T>(t: T) => U
>null : null >null : null
var r3 = foo(new Object()); // {} var r3 = foo(new Object()); // {}
>r3 : {} >r3 : Object
>foo(new Object()) : {} >foo(new Object()) : Object
>foo : <T, U extends T>(t: T) => U >foo : <T, U extends T>(t: T) => U
>new Object() : Object >new Object() : Object
>Object : ObjectConstructor >Object : ObjectConstructor

View file

@ -1004,7 +1004,7 @@ declare function f11<T, U = T | B>(a?: T, b?: U): [T, U];
// inference // inference
f11(); f11();
>f11() : [{}, {} | B] >f11() : [{}, {}]
>f11 : <T, U = B | T>(a?: T, b?: U) => [T, U] >f11 : <T, U = B | T>(a?: T, b?: U) => [T, U]
f11(a); f11(a);
@ -1607,7 +1607,7 @@ declare function f17<T = U, U = T | B>(a?: T, b?: U): [T, U];
// inference // inference
f17(); f17();
>f17() : [{}, {} | B] >f17() : [{}, {}]
>f17 : <T = U, U = B | T>(a?: T, b?: U) => [T, U] >f17 : <T = U, U = B | T>(a?: T, b?: U) => [T, U]
f17(a); f17(a);
@ -1702,11 +1702,11 @@ declare function f18<T, U = V, V = U | C>(a?: T, b?: U, c?: V): [T, U, V];
// inference // inference
f18(); f18();
>f18() : [{}, {}, {} | C] >f18() : [{}, {}, {}]
>f18 : <T, U = V, V = C | U>(a?: T, b?: U, c?: V) => [T, U, V] >f18 : <T, U = V, V = C | U>(a?: T, b?: U, c?: V) => [T, U, V]
f18(a); f18(a);
>f18(a) : [A, {}, {} | C] >f18(a) : [A, {}, {}]
>f18 : <T, U = V, V = C | U>(a?: T, b?: U, c?: V) => [T, U, V] >f18 : <T, U = V, V = C | U>(a?: T, b?: U, c?: V) => [T, U, V]
>a : A >a : A
@ -1732,25 +1732,25 @@ f18(a, b, c);
// no inference, partially supplied // no inference, partially supplied
f18<A>(); f18<A>();
>f18<A>() : [A, {}, {} | C] >f18<A>() : [A, {}, {}]
>f18 : <T, U = V, V = C | U>(a?: T, b?: U, c?: V) => [T, U, V] >f18 : <T, U = V, V = C | U>(a?: T, b?: U, c?: V) => [T, U, V]
>A : A >A : A
f18<A>(a); f18<A>(a);
>f18<A>(a) : [A, {}, {} | C] >f18<A>(a) : [A, {}, {}]
>f18 : <T, U = V, V = C | U>(a?: T, b?: U, c?: V) => [T, U, V] >f18 : <T, U = V, V = C | U>(a?: T, b?: U, c?: V) => [T, U, V]
>A : A >A : A
>a : A >a : A
f18<A>(a, b); f18<A>(a, b);
>f18<A>(a, b) : [A, {}, {} | C] >f18<A>(a, b) : [A, {}, {}]
>f18 : <T, U = V, V = C | U>(a?: T, b?: U, c?: V) => [T, U, V] >f18 : <T, U = V, V = C | U>(a?: T, b?: U, c?: V) => [T, U, V]
>A : A >A : A
>a : A >a : A
>b : B >b : B
f18<A>(a, b, b); f18<A>(a, b, b);
>f18<A>(a, b, b) : [A, {}, {} | C] >f18<A>(a, b, b) : [A, {}, {}]
>f18 : <T, U = V, V = C | U>(a?: T, b?: U, c?: V) => [T, U, V] >f18 : <T, U = V, V = C | U>(a?: T, b?: U, c?: V) => [T, U, V]
>A : A >A : A
>a : A >a : A
@ -1758,7 +1758,7 @@ f18<A>(a, b, b);
>b : B >b : B
f18<A>(a, b, c); f18<A>(a, b, c);
>f18<A>(a, b, c) : [A, {}, {} | C] >f18<A>(a, b, c) : [A, {}, {}]
>f18 : <T, U = V, V = C | U>(a?: T, b?: U, c?: V) => [T, U, V] >f18 : <T, U = V, V = C | U>(a?: T, b?: U, c?: V) => [T, U, V]
>A : A >A : A
>a : A >a : A

View file

@ -113,14 +113,14 @@ interface O {
} }
type NonIndexableUnion = boolean | {}; type NonIndexableUnion = boolean | {};
>NonIndexableUnion : NonIndexableUnion >NonIndexableUnion : {}
interface P { interface P {
>P : P >P : P
[u: NonIndexableUnion]: A; [u: NonIndexableUnion]: A;
>u : NonIndexableUnion >u : {}
>NonIndexableUnion : NonIndexableUnion >NonIndexableUnion : {}
>A : A >A : A
} }

View file

@ -40,8 +40,8 @@ export class BrokenClass {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
>new Promise((resolve, reject) => { this.doStuff(order.id) .then((items) => { order.items = items; resolve(order); }); }) : Promise<{}> >new Promise((resolve, reject) => { this.doStuff(order.id) .then((items) => { order.items = items; resolve(order); }); }) : Promise<{}>
>Promise : PromiseConstructor >Promise : PromiseConstructor
>(resolve, reject) => { this.doStuff(order.id) .then((items) => { order.items = items; resolve(order); }); } : (resolve: (value?: {} | PromiseLike<{}>) => void, reject: (reason?: any) => void) => void >(resolve, reject) => { this.doStuff(order.id) .then((items) => { order.items = items; resolve(order); }); } : (resolve: (value?: {}) => void, reject: (reason?: any) => void) => void
>resolve : (value?: {} | PromiseLike<{}>) => void >resolve : (value?: {}) => void
>reject : (reason?: any) => void >reject : (reason?: any) => void
this.doStuff(order.id) this.doStuff(order.id)
@ -69,7 +69,7 @@ export class BrokenClass {
resolve(order); resolve(order);
>resolve(order) : void >resolve(order) : void
>resolve : (value?: {} | PromiseLike<{}>) => void >resolve : (value?: {}) => void
>order : any >order : any
}); });

View file

@ -35,11 +35,11 @@ let x04: A & B & C;
>C : C >C : C
let x05: string & C; let x05: string & C;
>x05 : string & {} >x05 : string
>C : C >C : C
let x06: C & string; let x06: C & string;
>x06 : string & {} >x06 : string
>C : C >C : C
let x07: C; let x07: C;

View file

@ -138,8 +138,8 @@ async function out() {
return new Promise(function (resolve, reject) {}); return new Promise(function (resolve, reject) {});
>new Promise(function (resolve, reject) {}) : Promise<{}> >new Promise(function (resolve, reject) {}) : Promise<{}>
>Promise : PromiseConstructor >Promise : PromiseConstructor
>function (resolve, reject) {} : (resolve: (value?: {} | PromiseLike<{}>) => void, reject: (reason?: any) => void) => void >function (resolve, reject) {} : (resolve: (value?: {}) => void, reject: (reason?: any) => void) => void
>resolve : (value?: {} | PromiseLike<{}>) => void >resolve : (value?: {}) => void
>reject : (reason?: any) => void >reject : (reason?: any) => void
} }

View file

@ -138,8 +138,8 @@ async function out() {
return new Promise(function (resolve, reject) {}); return new Promise(function (resolve, reject) {});
>new Promise(function (resolve, reject) {}) : Promise<{}> >new Promise(function (resolve, reject) {}) : Promise<{}>
>Promise : PromiseConstructor >Promise : PromiseConstructor
>function (resolve, reject) {} : (resolve: (value?: {} | PromiseLike<{}>) => void, reject: (reason?: any) => void) => void >function (resolve, reject) {} : (resolve: (value?: {}) => void, reject: (reason?: any) => void) => void
>resolve : (value?: {} | PromiseLike<{}>) => void >resolve : (value?: {}) => void
>reject : (reason?: any) => void >reject : (reason?: any) => void
} }

View file

@ -138,8 +138,8 @@ async function out() {
return new Promise(function (resolve, reject) {}); return new Promise(function (resolve, reject) {});
>new Promise(function (resolve, reject) {}) : Promise<{}> >new Promise(function (resolve, reject) {}) : Promise<{}>
>Promise : PromiseConstructor >Promise : PromiseConstructor
>function (resolve, reject) {} : (resolve: (value?: {} | PromiseLike<{}>) => void, reject: (reason?: any) => void) => void >function (resolve, reject) {} : (resolve: (value?: {}) => void, reject: (reason?: any) => void) => void
>resolve : (value?: {} | PromiseLike<{}>) => void >resolve : (value?: {}) => void
>reject : (reason?: any) => void >reject : (reason?: any) => void
} }

View file

@ -1,7 +1,6 @@
tests/cases/conformance/types/nonPrimitive/nonPrimitiveUnionIntersection.ts(1,5): error TS2322: Type '""' is not assignable to type 'object & string'. tests/cases/conformance/types/nonPrimitive/nonPrimitiveUnionIntersection.ts(1,5): error TS2322: Type '""' is not assignable to type 'object & string'.
Type '""' is not assignable to type 'object'. Type '""' is not assignable to type 'object'.
tests/cases/conformance/types/nonPrimitive/nonPrimitiveUnionIntersection.ts(3,5): error TS2322: Type '123' is not assignable to type 'object & {}'. tests/cases/conformance/types/nonPrimitive/nonPrimitiveUnionIntersection.ts(3,5): error TS2322: Type '123' is not assignable to type 'object'.
Type '123' is not assignable to type 'object'.
tests/cases/conformance/types/nonPrimitive/nonPrimitiveUnionIntersection.ts(4,1): error TS2322: Type 'string' is not assignable to type 'object & string'. tests/cases/conformance/types/nonPrimitive/nonPrimitiveUnionIntersection.ts(4,1): error TS2322: Type 'string' is not assignable to type 'object & string'.
Type 'string' is not assignable to type 'object'. Type 'string' is not assignable to type 'object'.
tests/cases/conformance/types/nonPrimitive/nonPrimitiveUnionIntersection.ts(8,38): error TS2322: Type '{ bar: string; }' is not assignable to type 'object & { err: string; }'. tests/cases/conformance/types/nonPrimitive/nonPrimitiveUnionIntersection.ts(8,38): error TS2322: Type '{ bar: string; }' is not assignable to type 'object & { err: string; }'.
@ -16,8 +15,7 @@ tests/cases/conformance/types/nonPrimitive/nonPrimitiveUnionIntersection.ts(8,38
var b: object | string = ""; // ok var b: object | string = ""; // ok
var c: object & {} = 123; // error var c: object & {} = 123; // error
~ ~
!!! error TS2322: Type '123' is not assignable to type 'object & {}'. !!! error TS2322: Type '123' is not assignable to type 'object'.
!!! error TS2322: Type '123' is not assignable to type 'object'.
a = b; // error a = b; // error
~ ~
!!! error TS2322: Type 'string' is not assignable to type 'object & string'. !!! error TS2322: Type 'string' is not assignable to type 'object & string'.

View file

@ -8,7 +8,7 @@ var b: object | string = ""; // ok
>"" : "" >"" : ""
var c: object & {} = 123; // error var c: object & {} = 123; // error
>c : object & {} >c : object
>123 : 123 >123 : 123
a = b; // error a = b; // error
@ -22,7 +22,7 @@ b = a; // ok
>a : object & string >a : object & string
const foo: object & {} = {bar: 'bar'}; // ok const foo: object & {} = {bar: 'bar'}; // ok
>foo : object & {} >foo : object
>{bar: 'bar'} : { bar: string; } >{bar: 'bar'} : { bar: string; }
>bar : string >bar : string
>'bar' : "bar" >'bar' : "bar"

View file

@ -296,7 +296,7 @@ function conditionalSpreadBoolean(b: boolean) : { x: number, y: number } {
} }
let o2 = { ...b && { x: 21 }} let o2 = { ...b && { x: 21 }}
>o2 : {} >o2 : {}
>{ ...b && { x: 21 }} : {} | { x: number; } >{ ...b && { x: 21 }} : {}
>b && { x: 21 } : false | { x: number; } >b && { x: 21 } : false | { x: number; }
>b : boolean >b : boolean
>{ x: 21 } : { x: number; } >{ x: 21 } : { x: number; }
@ -337,7 +337,7 @@ function conditionalSpreadNumber(nt: number): { x: number, y: number } {
} }
let o2 = { ...nt && { x: nt }} let o2 = { ...nt && { x: nt }}
>o2 : {} >o2 : {}
>{ ...nt && { x: nt }} : {} | { x: number; } >{ ...nt && { x: nt }} : {}
>nt && { x: nt } : 0 | { x: number; } >nt && { x: nt } : 0 | { x: number; }
>nt : number >nt : number
>{ x: nt } : { x: number; } >{ x: nt } : { x: number; }
@ -378,7 +378,7 @@ function conditionalSpreadString(st: string): { x: string, y: number } {
} }
let o2 = { ...st && { x: st }} let o2 = { ...st && { x: st }}
>o2 : {} >o2 : {}
>{ ...st && { x: st }} : {} | { x: string; } >{ ...st && { x: st }} : {}
>st && { x: st } : "" | { x: string; } >st && { x: st } : "" | { x: string; }
>st : string >st : string
>{ x: st } : { x: string; } >{ x: st } : { x: string; }

View file

@ -1,41 +0,0 @@
tests/cases/conformance/types/spread/spreadUnion2.ts(5,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'o1' must be of type '{} | { a: number; }', but here has type '{}'.
tests/cases/conformance/types/spread/spreadUnion2.ts(8,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'o2' must be of type '{} | { b: number; }', but here has type '{}'.
tests/cases/conformance/types/spread/spreadUnion2.ts(11,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'o3' must be of type '{} | { a: number; } | { b: number; } | { a: number; b: number; }', but here has type '{}'.
tests/cases/conformance/types/spread/spreadUnion2.ts(12,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'o3' must be of type '{} | { a: number; } | { b: number; } | { a: number; b: number; }', but here has type '{}'.
tests/cases/conformance/types/spread/spreadUnion2.ts(15,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'o4' must be of type '{} | { a: number; }', but here has type '{}'.
tests/cases/conformance/types/spread/spreadUnion2.ts(18,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'o5' must be of type '{} | { b: number; }', but here has type '{}'.
==== tests/cases/conformance/types/spread/spreadUnion2.ts (6 errors) ====
declare const undefinedUnion: { a: number } | undefined;
declare const nullUnion: { b: number } | null;
var o1: {} | { a: number };
var o1 = { ...undefinedUnion };
~~
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'o1' must be of type '{} | { a: number; }', but here has type '{}'.
var o2: {} | { b: number };
var o2 = { ...nullUnion };
~~
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'o2' must be of type '{} | { b: number; }', but here has type '{}'.
var o3: {} | { a: number } | { b: number } | { a: number, b: number };
var o3 = { ...undefinedUnion, ...nullUnion };
~~
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'o3' must be of type '{} | { a: number; } | { b: number; } | { a: number; b: number; }', but here has type '{}'.
var o3 = { ...nullUnion, ...undefinedUnion };
~~
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'o3' must be of type '{} | { a: number; } | { b: number; } | { a: number; b: number; }', but here has type '{}'.
var o4: {} | { a: number };
var o4 = { ...undefinedUnion, ...undefinedUnion };
~~
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'o4' must be of type '{} | { a: number; }', but here has type '{}'.
var o5: {} | { b: number };
var o5 = { ...nullUnion, ...nullUnion };
~~
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'o5' must be of type '{} | { b: number; }', but here has type '{}'.

View file

@ -9,58 +9,58 @@ declare const nullUnion: { b: number } | null;
>null : null >null : null
var o1: {} | { a: number }; var o1: {} | { a: number };
>o1 : {} | { a: number; } >o1 : {}
>a : number >a : number
var o1 = { ...undefinedUnion }; var o1 = { ...undefinedUnion };
>o1 : {} | { a: number; } >o1 : {}
>{ ...undefinedUnion } : {} | { a: number; } >{ ...undefinedUnion } : {} | { a: number; }
>undefinedUnion : { a: number; } | undefined >undefinedUnion : { a: number; } | undefined
var o2: {} | { b: number }; var o2: {} | { b: number };
>o2 : {} | { b: number; } >o2 : {}
>b : number >b : number
var o2 = { ...nullUnion }; var o2 = { ...nullUnion };
>o2 : {} | { b: number; } >o2 : {}
>{ ...nullUnion } : {} | { b: number; } >{ ...nullUnion } : {} | { b: number; }
>nullUnion : { b: number; } | null >nullUnion : { b: number; } | null
var o3: {} | { a: number } | { b: number } | { a: number, b: number }; var o3: {} | { a: number } | { b: number } | { a: number, b: number };
>o3 : {} | { a: number; } | { b: number; } | { a: number; b: number; } >o3 : {}
>a : number >a : number
>b : number >b : number
>a : number >a : number
>b : number >b : number
var o3 = { ...undefinedUnion, ...nullUnion }; var o3 = { ...undefinedUnion, ...nullUnion };
>o3 : {} | { a: number; } | { b: number; } | { a: number; b: number; } >o3 : {}
>{ ...undefinedUnion, ...nullUnion } : {} | { b: number; } | { a: number; } | { b: number; a: number; } >{ ...undefinedUnion, ...nullUnion } : {} | { b: number; } | { a: number; } | { b: number; a: number; }
>undefinedUnion : { a: number; } | undefined >undefinedUnion : { a: number; } | undefined
>nullUnion : { b: number; } | null >nullUnion : { b: number; } | null
var o3 = { ...nullUnion, ...undefinedUnion }; var o3 = { ...nullUnion, ...undefinedUnion };
>o3 : {} | { a: number; } | { b: number; } | { a: number; b: number; } >o3 : {}
>{ ...nullUnion, ...undefinedUnion } : {} | { a: number; } | { b: number; } | { a: number; b: number; } >{ ...nullUnion, ...undefinedUnion } : {} | { a: number; } | { b: number; } | { a: number; b: number; }
>nullUnion : { b: number; } | null >nullUnion : { b: number; } | null
>undefinedUnion : { a: number; } | undefined >undefinedUnion : { a: number; } | undefined
var o4: {} | { a: number }; var o4: {} | { a: number };
>o4 : {} | { a: number; } >o4 : {}
>a : number >a : number
var o4 = { ...undefinedUnion, ...undefinedUnion }; var o4 = { ...undefinedUnion, ...undefinedUnion };
>o4 : {} | { a: number; } >o4 : {}
>{ ...undefinedUnion, ...undefinedUnion } : {} | { a: number; } | { a: number; } | { a: number; } >{ ...undefinedUnion, ...undefinedUnion } : {} | { a: number; } | { a: number; } | { a: number; }
>undefinedUnion : { a: number; } | undefined >undefinedUnion : { a: number; } | undefined
>undefinedUnion : { a: number; } | undefined >undefinedUnion : { a: number; } | undefined
var o5: {} | { b: number }; var o5: {} | { b: number };
>o5 : {} | { b: number; } >o5 : {}
>b : number >b : number
var o5 = { ...nullUnion, ...nullUnion }; var o5 = { ...nullUnion, ...nullUnion };
>o5 : {} | { b: number; } >o5 : {}
>{ ...nullUnion, ...nullUnion } : {} | { b: number; } | { b: number; } | { b: number; } >{ ...nullUnion, ...nullUnion } : {} | { b: number; } | { b: number; } | { b: number; }
>nullUnion : { b: number; } | null >nullUnion : { b: number; } | null
>nullUnion : { b: number; } | null >nullUnion : { b: number; } | null

View file

@ -77,10 +77,12 @@ extend1({
>foo : Symbol(foo, Decl(thisTypeInFunctions2.ts, 26, 13)) >foo : Symbol(foo, Decl(thisTypeInFunctions2.ts, 26, 13))
this.url; // this: any because 'foo' matches the string indexer this.url; // this: any because 'foo' matches the string indexer
>this : Symbol(this, Decl(thisTypeInFunctions2.ts, 4, 87)) >this : Symbol(IndexedWithThis, Decl(thisTypeInFunctions2.ts, 0, 0))
this.willDestroy; this.willDestroy;
>this : Symbol(this, Decl(thisTypeInFunctions2.ts, 4, 87)) >this.willDestroy : Symbol(IndexedWithThis.willDestroy, Decl(thisTypeInFunctions2.ts, 2, 32))
>this : Symbol(IndexedWithThis, Decl(thisTypeInFunctions2.ts, 0, 0))
>willDestroy : Symbol(IndexedWithThis.willDestroy, Decl(thisTypeInFunctions2.ts, 2, 32))
} }
}); });
extend2({ extend2({

View file

@ -58,7 +58,7 @@ declare function simple(arg: SimpleInterface): void;
extend1({ extend1({
>extend1({ init() { this // this: IndexedWithThis because of contextual typing. // this.mine this.willDestroy }, mine: 12, foo() { this.url; // this: any because 'foo' matches the string indexer this.willDestroy; }}) : void >extend1({ init() { this // this: IndexedWithThis because of contextual typing. // this.mine this.willDestroy }, mine: 12, foo() { this.url; // this: any because 'foo' matches the string indexer this.willDestroy; }}) : void
>extend1 : (args: IndexedWithThis) => void >extend1 : (args: IndexedWithThis) => void
>{ init() { this // this: IndexedWithThis because of contextual typing. // this.mine this.willDestroy }, mine: 12, foo() { this.url; // this: any because 'foo' matches the string indexer this.willDestroy; }} : { init(this: IndexedWithThis): void; mine: number; foo(this: any): void; } >{ init() { this // this: IndexedWithThis because of contextual typing. // this.mine this.willDestroy }, mine: 12, foo() { this.url; // this: any because 'foo' matches the string indexer this.willDestroy; }} : { init(this: IndexedWithThis): void; mine: number; foo(): void; }
init() { init() {
>init : (this: IndexedWithThis) => void >init : (this: IndexedWithThis) => void
@ -78,17 +78,17 @@ extend1({
>12 : 12 >12 : 12
foo() { foo() {
>foo : (this: any) => void >foo : () => void
this.url; // this: any because 'foo' matches the string indexer this.url; // this: any because 'foo' matches the string indexer
>this.url : any >this.url : {}
>this : any >this : IndexedWithThis
>url : any >url : {}
this.willDestroy; this.willDestroy;
>this.willDestroy : any >this.willDestroy : (this: any) => void
>this : any >this : IndexedWithThis
>willDestroy : any >willDestroy : (this: any) => void
} }
}); });
extend2({ extend2({

View file

@ -1,4 +1,4 @@
tests/cases/conformance/jsx/file.tsx(11,10): error TS2559: Type '{ prop1: string; }' has no properties in common with type 'IntrinsicAttributes & IntrinsicClassAttributes<BigGreeter> & { children?: ReactNode; }'. tests/cases/conformance/jsx/file.tsx(11,10): error TS2559: Type '{ prop1: string; }' has no properties in common with type 'IntrinsicAttributes & IntrinsicClassAttributes<BigGreeter> & { children?: {}; }'.
==== tests/cases/conformance/jsx/file.tsx (1 errors) ==== ==== tests/cases/conformance/jsx/file.tsx (1 errors) ====
@ -14,7 +14,7 @@ tests/cases/conformance/jsx/file.tsx(11,10): error TS2559: Type '{ prop1: string
// Error // Error
let a = <BigGreeter prop1="hello" /> let a = <BigGreeter prop1="hello" />
~~~~~~~~~~ ~~~~~~~~~~
!!! error TS2559: Type '{ prop1: string; }' has no properties in common with type 'IntrinsicAttributes & IntrinsicClassAttributes<BigGreeter> & { children?: ReactNode; }'. !!! error TS2559: Type '{ prop1: string; }' has no properties in common with type 'IntrinsicAttributes & IntrinsicClassAttributes<BigGreeter> & { children?: {}; }'.
// OK // OK
let b = <BigGreeter ref={(input) => { this.textInput = input; }} /> let b = <BigGreeter ref={(input) => { this.textInput = input; }} />

View file

@ -15,11 +15,11 @@ const decorator = function <T>(Component: React.StatelessComponent<T>): React.St
>T : T >T : T
return (props) => <Component {...props}></Component> return (props) => <Component {...props}></Component>
>(props) => <Component {...props}></Component> : (props: T & { children?: React.ReactNode; }) => JSX.Element >(props) => <Component {...props}></Component> : (props: T & { children?: {}; }) => JSX.Element
>props : T & { children?: React.ReactNode; } >props : T & { children?: {}; }
><Component {...props}></Component> : JSX.Element ><Component {...props}></Component> : JSX.Element
>Component : React.StatelessComponent<T> >Component : React.StatelessComponent<T>
>props : T & { children?: React.ReactNode; } >props : T & { children?: {}; }
>Component : React.StatelessComponent<T> >Component : React.StatelessComponent<T>
}; };
@ -38,11 +38,11 @@ const decorator2 = function <T extends { x: number }>(Component: React.Stateless
>T : T >T : T
return (props) => <Component {...props} x={2} ></Component> return (props) => <Component {...props} x={2} ></Component>
>(props) => <Component {...props} x={2} ></Component> : (props: T & { children?: React.ReactNode; }) => JSX.Element >(props) => <Component {...props} x={2} ></Component> : (props: T & { children?: {}; }) => JSX.Element
>props : T & { children?: React.ReactNode; } >props : T & { children?: {}; }
><Component {...props} x={2} ></Component> : JSX.Element ><Component {...props} x={2} ></Component> : JSX.Element
>Component : React.StatelessComponent<T> >Component : React.StatelessComponent<T>
>props : T & { children?: React.ReactNode; } >props : T & { children?: {}; }
>x : number >x : number
>2 : 2 >2 : 2
>Component : React.StatelessComponent<T> >Component : React.StatelessComponent<T>
@ -65,13 +65,13 @@ const decorator3 = function <T extends { x: number }, U extends { x: number } >(
>T : T >T : T
return (props) => <Component x={2} {...props} ></Component> return (props) => <Component x={2} {...props} ></Component>
>(props) => <Component x={2} {...props} ></Component> : (props: T & { children?: React.ReactNode; }) => JSX.Element >(props) => <Component x={2} {...props} ></Component> : (props: T & { children?: {}; }) => JSX.Element
>props : T & { children?: React.ReactNode; } >props : T & { children?: {}; }
><Component x={2} {...props} ></Component> : JSX.Element ><Component x={2} {...props} ></Component> : JSX.Element
>Component : React.StatelessComponent<T> >Component : React.StatelessComponent<T>
>x : number >x : number
>2 : 2 >2 : 2
>props : T & { children?: React.ReactNode; } >props : T & { children?: {}; }
>Component : React.StatelessComponent<T> >Component : React.StatelessComponent<T>
}; };

View file

@ -1,4 +1,4 @@
tests/cases/conformance/jsx/file.tsx(4,45): error TS2339: Property 'y' does not exist on type 'IntrinsicAttributes & { x: number; } & { children?: ReactNode; }'. tests/cases/conformance/jsx/file.tsx(4,45): error TS2339: Property 'y' does not exist on type 'IntrinsicAttributes & { x: number; } & { children?: {}; }'.
==== tests/cases/conformance/jsx/file.tsx (1 errors) ==== ==== tests/cases/conformance/jsx/file.tsx (1 errors) ====
@ -7,5 +7,5 @@ tests/cases/conformance/jsx/file.tsx(4,45): error TS2339: Property 'y' does not
const decorator4 = function <T extends { x: number }>(Component: React.StatelessComponent<T>): React.StatelessComponent<T> { const decorator4 = function <T extends { x: number }>(Component: React.StatelessComponent<T>): React.StatelessComponent<T> {
return (props) => <Component {...props} y={"blah"} ></Component> return (props) => <Component {...props} y={"blah"} ></Component>
~~~~~~~~~~ ~~~~~~~~~~
!!! error TS2339: Property 'y' does not exist on type 'IntrinsicAttributes & { x: number; } & { children?: ReactNode; }'. !!! error TS2339: Property 'y' does not exist on type 'IntrinsicAttributes & { x: number; } & { children?: {}; }'.
}; };

View file

@ -16,11 +16,11 @@ const decorator4 = function <T extends { x: number }>(Component: React.Stateless
>T : T >T : T
return (props) => <Component {...props} y={"blah"} ></Component> return (props) => <Component {...props} y={"blah"} ></Component>
>(props) => <Component {...props} y={"blah"} ></Component> : (props: T & { children?: React.ReactNode; }) => JSX.Element >(props) => <Component {...props} y={"blah"} ></Component> : (props: T & { children?: {}; }) => JSX.Element
>props : T & { children?: React.ReactNode; } >props : T & { children?: {}; }
><Component {...props} y={"blah"} ></Component> : JSX.Element ><Component {...props} y={"blah"} ></Component> : JSX.Element
>Component : React.StatelessComponent<T> >Component : React.StatelessComponent<T>
>props : T & { children?: React.ReactNode; } >props : T & { children?: {}; }
>y : string >y : string
>"blah" : "blah" >"blah" : "blah"
>Component : React.StatelessComponent<T> >Component : React.StatelessComponent<T>

View file

@ -35,9 +35,9 @@ class B<U> extends React.Component<U, {}> {
return <B1 {...this.props} x="hi" />; return <B1 {...this.props} x="hi" />;
><B1 {...this.props} x="hi" /> : JSX.Element ><B1 {...this.props} x="hi" /> : JSX.Element
>B1 : typeof B1 >B1 : typeof B1
>this.props : U & { children?: React.ReactNode; } >this.props : U & { children?: {}; }
>this : this >this : this
>props : U & { children?: React.ReactNode; } >props : U & { children?: {}; }
>x : string >x : string
} }
} }

View file

@ -34,9 +34,9 @@ class B<U> extends React.Component<U, {}> {
return <B1 {...this.props} x="hi" />; return <B1 {...this.props} x="hi" />;
><B1 {...this.props} x="hi" /> : JSX.Element ><B1 {...this.props} x="hi" /> : JSX.Element
>B1 : typeof B1 >B1 : typeof B1
>this.props : U & { children?: React.ReactNode; } >this.props : U & { children?: {}; }
>this : this >this : this
>props : U & { children?: React.ReactNode; } >props : U & { children?: {}; }
>x : string >x : string
} }
} }

View file

@ -28,9 +28,9 @@ export function makeP<P>(Ctor: React.ComponentClass<P>) {
<Ctor {...this.props } /> <Ctor {...this.props } />
><Ctor {...this.props } /> : JSX.Element ><Ctor {...this.props } /> : JSX.Element
>Ctor : React.ComponentClass<P> >Ctor : React.ComponentClass<P>
>this.props : P & { children?: React.ReactNode; } >this.props : P & { children?: {}; }
>this : this >this : this
>props : P & { children?: React.ReactNode; } >props : P & { children?: {}; }
); );
} }

View file

@ -1,4 +1,4 @@
tests/cases/conformance/jsx/file.tsx(13,11): error TS2322: Type '{}' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<MyComp<Prop>> & Prop & { children?: ReactNode; }'. tests/cases/conformance/jsx/file.tsx(13,11): error TS2322: Type '{}' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<MyComp<Prop>> & Prop & { children?: {}; }'.
Type '{}' is not assignable to type 'Prop'. Type '{}' is not assignable to type 'Prop'.
Property 'a' is missing in type '{}'. Property 'a' is missing in type '{}'.
tests/cases/conformance/jsx/file.tsx(19,18): error TS2326: Types of property 'a' are incompatible. tests/cases/conformance/jsx/file.tsx(19,18): error TS2326: Types of property 'a' are incompatible.
@ -20,7 +20,7 @@ tests/cases/conformance/jsx/file.tsx(19,18): error TS2326: Types of property 'a'
// Error // Error
let x1 = <MyComp /> let x1 = <MyComp />
~~~~~~ ~~~~~~
!!! error TS2322: Type '{}' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<MyComp<Prop>> & Prop & { children?: ReactNode; }'. !!! error TS2322: Type '{}' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<MyComp<Prop>> & Prop & { children?: {}; }'.
!!! error TS2322: Type '{}' is not assignable to type 'Prop'. !!! error TS2322: Type '{}' is not assignable to type 'Prop'.
!!! error TS2322: Property 'a' is missing in type '{}'. !!! error TS2322: Property 'a' is missing in type '{}'.

View file

@ -2,7 +2,7 @@ tests/cases/conformance/jsx/file.tsx(27,33): error TS2326: Types of property 'y'
Type 'true' is not assignable to type 'false'. Type 'true' is not assignable to type 'false'.
tests/cases/conformance/jsx/file.tsx(28,50): error TS2326: Types of property 'x' are incompatible. tests/cases/conformance/jsx/file.tsx(28,50): error TS2326: Types of property 'x' are incompatible.
Type '3' is not assignable to type '2'. Type '3' is not assignable to type '2'.
tests/cases/conformance/jsx/file.tsx(30,11): error TS2322: Type '{ y: true; x: 2; overwrite: string; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<OverWriteAttr> & Prop & { children?: ReactNode; }'. tests/cases/conformance/jsx/file.tsx(30,11): error TS2322: Type '{ y: true; x: 2; overwrite: string; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<OverWriteAttr> & Prop & { children?: {}; }'.
Type '{ y: true; x: 2; overwrite: string; }' is not assignable to type 'Prop'. Type '{ y: true; x: 2; overwrite: string; }' is not assignable to type 'Prop'.
Types of property 'y' are incompatible. Types of property 'y' are incompatible.
Type 'true' is not assignable to type 'false'. Type 'true' is not assignable to type 'false'.
@ -46,7 +46,7 @@ tests/cases/conformance/jsx/file.tsx(30,11): error TS2322: Type '{ y: true; x: 2
let x2 = <OverWriteAttr {...anyobj} x={3} /> let x2 = <OverWriteAttr {...anyobj} x={3} />
let x3 = <OverWriteAttr overwrite="hi" {...obj1} {...{y: true}} /> let x3 = <OverWriteAttr overwrite="hi" {...obj1} {...{y: true}} />
~~~~~~~~~~~~~ ~~~~~~~~~~~~~
!!! error TS2322: Type '{ y: true; x: 2; overwrite: string; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<OverWriteAttr> & Prop & { children?: ReactNode; }'. !!! error TS2322: Type '{ y: true; x: 2; overwrite: string; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<OverWriteAttr> & Prop & { children?: {}; }'.
!!! error TS2322: Type '{ y: true; x: 2; overwrite: string; }' is not assignable to type 'Prop'. !!! error TS2322: Type '{ y: true; x: 2; overwrite: string; }' is not assignable to type 'Prop'.
!!! error TS2322: Types of property 'y' are incompatible. !!! error TS2322: Types of property 'y' are incompatible.
!!! error TS2322: Type 'true' is not assignable to type 'false'. !!! error TS2322: Type 'true' is not assignable to type 'false'.

View file

@ -1,18 +1,18 @@
tests/cases/conformance/jsx/file.tsx(17,10): error TS2322: Type '{}' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<Poisoned> & PoisonedProp & { children?: ReactNode; }'. tests/cases/conformance/jsx/file.tsx(17,10): error TS2322: Type '{}' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<Poisoned> & PoisonedProp & { children?: {}; }'.
Type '{}' is not assignable to type 'PoisonedProp'. Type '{}' is not assignable to type 'PoisonedProp'.
Property 'x' is missing in type '{}'. Property 'x' is missing in type '{}'.
tests/cases/conformance/jsx/file.tsx(18,10): error TS2322: Type '{}' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<Poisoned> & PoisonedProp & { children?: ReactNode; }'. tests/cases/conformance/jsx/file.tsx(18,10): error TS2322: Type '{}' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<Poisoned> & PoisonedProp & { children?: {}; }'.
Type '{}' is not assignable to type 'PoisonedProp'. Type '{}' is not assignable to type 'PoisonedProp'.
Property 'x' is missing in type '{}'. Property 'x' is missing in type '{}'.
tests/cases/conformance/jsx/file.tsx(19,19): error TS2326: Types of property 'x' are incompatible. tests/cases/conformance/jsx/file.tsx(19,19): error TS2326: Types of property 'x' are incompatible.
Type 'true' is not assignable to type 'string'. Type 'true' is not assignable to type 'string'.
tests/cases/conformance/jsx/file.tsx(19,21): error TS2326: Types of property 'y' are incompatible. tests/cases/conformance/jsx/file.tsx(19,21): error TS2326: Types of property 'y' are incompatible.
Type 'true' is not assignable to type '"2"'. Type 'true' is not assignable to type '"2"'.
tests/cases/conformance/jsx/file.tsx(20,10): error TS2322: Type '{ x: number; y: "2"; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<Poisoned> & PoisonedProp & { children?: ReactNode; }'. tests/cases/conformance/jsx/file.tsx(20,10): error TS2322: Type '{ x: number; y: "2"; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<Poisoned> & PoisonedProp & { children?: {}; }'.
Type '{ x: number; y: "2"; }' is not assignable to type 'PoisonedProp'. Type '{ x: number; y: "2"; }' is not assignable to type 'PoisonedProp'.
Types of property 'x' are incompatible. Types of property 'x' are incompatible.
Type 'number' is not assignable to type 'string'. Type 'number' is not assignable to type 'string'.
tests/cases/conformance/jsx/file.tsx(21,11): error TS2322: Type '{ X: string; x: number; y: "2"; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<Poisoned> & PoisonedProp & { children?: ReactNode; }'. tests/cases/conformance/jsx/file.tsx(21,11): error TS2322: Type '{ X: string; x: number; y: "2"; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<Poisoned> & PoisonedProp & { children?: {}; }'.
Type '{ X: string; x: number; y: "2"; }' is not assignable to type 'PoisonedProp'. Type '{ X: string; x: number; y: "2"; }' is not assignable to type 'PoisonedProp'.
Types of property 'x' are incompatible. Types of property 'x' are incompatible.
Type 'number' is not assignable to type 'string'. Type 'number' is not assignable to type 'string'.
@ -37,12 +37,12 @@ tests/cases/conformance/jsx/file.tsx(21,11): error TS2322: Type '{ X: string; x:
// Error // Error
let p = <Poisoned {...obj} />; let p = <Poisoned {...obj} />;
~~~~~~~~ ~~~~~~~~
!!! error TS2322: Type '{}' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<Poisoned> & PoisonedProp & { children?: ReactNode; }'. !!! error TS2322: Type '{}' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<Poisoned> & PoisonedProp & { children?: {}; }'.
!!! error TS2322: Type '{}' is not assignable to type 'PoisonedProp'. !!! error TS2322: Type '{}' is not assignable to type 'PoisonedProp'.
!!! error TS2322: Property 'x' is missing in type '{}'. !!! error TS2322: Property 'x' is missing in type '{}'.
let y = <Poisoned />; let y = <Poisoned />;
~~~~~~~~ ~~~~~~~~
!!! error TS2322: Type '{}' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<Poisoned> & PoisonedProp & { children?: ReactNode; }'. !!! error TS2322: Type '{}' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<Poisoned> & PoisonedProp & { children?: {}; }'.
!!! error TS2322: Type '{}' is not assignable to type 'PoisonedProp'. !!! error TS2322: Type '{}' is not assignable to type 'PoisonedProp'.
!!! error TS2322: Property 'x' is missing in type '{}'. !!! error TS2322: Property 'x' is missing in type '{}'.
let z = <Poisoned x y/>; let z = <Poisoned x y/>;
@ -54,13 +54,13 @@ tests/cases/conformance/jsx/file.tsx(21,11): error TS2322: Type '{ X: string; x:
!!! error TS2326: Type 'true' is not assignable to type '"2"'. !!! error TS2326: Type 'true' is not assignable to type '"2"'.
let w = <Poisoned {...{x: 5, y: "2"}}/>; let w = <Poisoned {...{x: 5, y: "2"}}/>;
~~~~~~~~ ~~~~~~~~
!!! error TS2322: Type '{ x: number; y: "2"; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<Poisoned> & PoisonedProp & { children?: ReactNode; }'. !!! error TS2322: Type '{ x: number; y: "2"; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<Poisoned> & PoisonedProp & { children?: {}; }'.
!!! error TS2322: Type '{ x: number; y: "2"; }' is not assignable to type 'PoisonedProp'. !!! error TS2322: Type '{ x: number; y: "2"; }' is not assignable to type 'PoisonedProp'.
!!! error TS2322: Types of property 'x' are incompatible. !!! error TS2322: Types of property 'x' are incompatible.
!!! error TS2322: Type 'number' is not assignable to type 'string'. !!! error TS2322: Type 'number' is not assignable to type 'string'.
let w1 = <Poisoned {...{x: 5, y: "2"}} X="hi" />; let w1 = <Poisoned {...{x: 5, y: "2"}} X="hi" />;
~~~~~~~~ ~~~~~~~~
!!! error TS2322: Type '{ X: string; x: number; y: "2"; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<Poisoned> & PoisonedProp & { children?: ReactNode; }'. !!! error TS2322: Type '{ X: string; x: number; y: "2"; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<Poisoned> & PoisonedProp & { children?: {}; }'.
!!! error TS2322: Type '{ X: string; x: number; y: "2"; }' is not assignable to type 'PoisonedProp'. !!! error TS2322: Type '{ X: string; x: number; y: "2"; }' is not assignable to type 'PoisonedProp'.
!!! error TS2322: Types of property 'x' are incompatible. !!! error TS2322: Types of property 'x' are incompatible.
!!! error TS2322: Type 'number' is not assignable to type 'string'. !!! error TS2322: Type 'number' is not assignable to type 'string'.

View file

@ -1,8 +1,8 @@
tests/cases/conformance/jsx/file.tsx(20,10): error TS2322: Type '{ x: string; y: number; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<Poisoned> & PoisonedProp & { children?: ReactNode; }'. tests/cases/conformance/jsx/file.tsx(20,10): error TS2322: Type '{ x: string; y: number; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<Poisoned> & PoisonedProp & { children?: {}; }'.
Type '{ x: string; y: number; }' is not assignable to type 'PoisonedProp'. Type '{ x: string; y: number; }' is not assignable to type 'PoisonedProp'.
Types of property 'y' are incompatible. Types of property 'y' are incompatible.
Type 'number' is not assignable to type '2'. Type 'number' is not assignable to type '2'.
tests/cases/conformance/jsx/file.tsx(33,10): error TS2559: Type '{ prop1: boolean; }' has no properties in common with type 'IntrinsicAttributes & IntrinsicClassAttributes<EmptyProp> & { children?: ReactNode; }'. tests/cases/conformance/jsx/file.tsx(33,10): error TS2559: Type '{ prop1: boolean; }' has no properties in common with type 'IntrinsicAttributes & IntrinsicClassAttributes<EmptyProp> & { children?: {}; }'.
==== tests/cases/conformance/jsx/file.tsx (2 errors) ==== ==== tests/cases/conformance/jsx/file.tsx (2 errors) ====
@ -27,7 +27,7 @@ tests/cases/conformance/jsx/file.tsx(33,10): error TS2559: Type '{ prop1: boolea
// Error as "obj" has type { x: string; y: number } // Error as "obj" has type { x: string; y: number }
let p = <Poisoned {...obj} />; let p = <Poisoned {...obj} />;
~~~~~~~~ ~~~~~~~~
!!! error TS2322: Type '{ x: string; y: number; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<Poisoned> & PoisonedProp & { children?: ReactNode; }'. !!! error TS2322: Type '{ x: string; y: number; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<Poisoned> & PoisonedProp & { children?: {}; }'.
!!! error TS2322: Type '{ x: string; y: number; }' is not assignable to type 'PoisonedProp'. !!! error TS2322: Type '{ x: string; y: number; }' is not assignable to type 'PoisonedProp'.
!!! error TS2322: Types of property 'y' are incompatible. !!! error TS2322: Types of property 'y' are incompatible.
!!! error TS2322: Type 'number' is not assignable to type '2'. !!! error TS2322: Type 'number' is not assignable to type '2'.
@ -45,4 +45,4 @@ tests/cases/conformance/jsx/file.tsx(33,10): error TS2559: Type '{ prop1: boolea
// Ok // 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; }'. !!! error TS2559: Type '{ prop1: boolean; }' has no properties in common with type 'IntrinsicAttributes & IntrinsicClassAttributes<EmptyProp> & { children?: {}; }'.

View file

@ -1,5 +1,5 @@
tests/cases/conformance/jsx/file.tsx(13,10): error TS2322: Type '{ editable: true; }' is not assignable to type '(IntrinsicAttributes & IntrinsicClassAttributes<TextComponent> & { editable: false; } & { children?: ReactNode; }) | (IntrinsicAttributes & IntrinsicClassAttributes<TextComponent> & { editable: true; onEdit: (newText: string) => void; } & { children?: ReactNode; })'. tests/cases/conformance/jsx/file.tsx(13,10): error TS2322: Type '{ editable: true; }' is not assignable to type '(IntrinsicAttributes & IntrinsicClassAttributes<TextComponent> & { editable: false; } & { children?: {}; }) | (IntrinsicAttributes & IntrinsicClassAttributes<TextComponent> & { editable: true; onEdit: (newText: string) => void; } & { children?: {}; })'.
Type '{ editable: true; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<TextComponent> & { editable: true; onEdit: (newText: string) => void; } & { children?: ReactNode; }'. Type '{ editable: true; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<TextComponent> & { editable: true; onEdit: (newText: string) => void; } & { children?: {}; }'.
Type '{ editable: true; }' is not assignable to type '{ editable: true; onEdit: (newText: string) => void; }'. Type '{ editable: true; }' is not assignable to type '{ editable: true; onEdit: (newText: string) => void; }'.
Property 'onEdit' is missing in type '{ editable: true; }'. Property 'onEdit' is missing in type '{ editable: true; }'.
@ -19,8 +19,8 @@ tests/cases/conformance/jsx/file.tsx(13,10): error TS2322: Type '{ editable: tru
// Error // Error
let x = <TextComponent editable={true} /> let x = <TextComponent editable={true} />
~~~~~~~~~~~~~ ~~~~~~~~~~~~~
!!! error TS2322: Type '{ editable: true; }' is not assignable to type '(IntrinsicAttributes & IntrinsicClassAttributes<TextComponent> & { editable: false; } & { children?: ReactNode; }) | (IntrinsicAttributes & IntrinsicClassAttributes<TextComponent> & { editable: true; onEdit: (newText: string) => void; } & { children?: ReactNode; })'. !!! error TS2322: Type '{ editable: true; }' is not assignable to type '(IntrinsicAttributes & IntrinsicClassAttributes<TextComponent> & { editable: false; } & { children?: {}; }) | (IntrinsicAttributes & IntrinsicClassAttributes<TextComponent> & { editable: true; onEdit: (newText: string) => void; } & { children?: {}; })'.
!!! error TS2322: Type '{ editable: true; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<TextComponent> & { editable: true; onEdit: (newText: string) => void; } & { children?: ReactNode; }'. !!! error TS2322: Type '{ editable: true; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<TextComponent> & { editable: true; onEdit: (newText: string) => void; } & { children?: {}; }'.
!!! error TS2322: Type '{ editable: true; }' is not assignable to type '{ editable: true; onEdit: (newText: string) => void; }'. !!! error TS2322: Type '{ editable: true; }' is not assignable to type '{ editable: true; onEdit: (newText: string) => void; }'.
!!! error TS2322: Property 'onEdit' is missing in type '{ editable: true; }'. !!! error TS2322: Property 'onEdit' is missing in type '{ editable: true; }'.

View file

@ -21,8 +21,8 @@ var MainMenu: React.StatelessComponent<{}> = (props) => (<div>
>MainMenu : React.StatelessComponent<{}> >MainMenu : React.StatelessComponent<{}>
>React : any >React : any
>StatelessComponent : React.StatelessComponent<P> >StatelessComponent : React.StatelessComponent<P>
>(props) => (<div> <h3>Main Menu</h3></div>) : (props: { children?: React.ReactNode; }) => JSX.Element >(props) => (<div> <h3>Main Menu</h3></div>) : (props: { children?: {}; }) => JSX.Element
>props : { children?: React.ReactNode; } >props : { children?: {}; }
>(<div> <h3>Main Menu</h3></div>) : JSX.Element >(<div> <h3>Main Menu</h3></div>) : JSX.Element
><div> <h3>Main Menu</h3></div> : JSX.Element ><div> <h3>Main Menu</h3></div> : JSX.Element
>div : any >div : any
@ -40,7 +40,7 @@ var App: React.StatelessComponent<{ children }> = ({children}) => (
>React : any >React : any
>StatelessComponent : React.StatelessComponent<P> >StatelessComponent : React.StatelessComponent<P>
>children : any >children : any
>({children}) => ( <div > <MainMenu/> </div>) : ({ children }: { children: any; } & { children?: React.ReactNode; }) => JSX.Element >({children}) => ( <div > <MainMenu/> </div>) : ({ children }: { children: any; } & { children?: {}; }) => JSX.Element
>children : any >children : any
>( <div > <MainMenu/> </div>) : JSX.Element >( <div > <MainMenu/> </div>) : JSX.Element

View file

@ -15,9 +15,9 @@ tests/cases/conformance/jsx/file.tsx(41,14): error TS2344: Type 'Prop' does not
tests/cases/conformance/jsx/file.tsx(41,20): error TS2326: Types of property 'a' are incompatible. tests/cases/conformance/jsx/file.tsx(41,20): error TS2326: Types of property 'a' are incompatible.
Type 'number' is not assignable to type 'string'. Type 'number' is not assignable to type 'string'.
tests/cases/conformance/jsx/file.tsx(47,14): error TS2558: Expected 1-2 type arguments, but got 3. tests/cases/conformance/jsx/file.tsx(47,14): error TS2558: Expected 1-2 type arguments, but got 3.
tests/cases/conformance/jsx/file.tsx(47,53): error TS2339: Property 'b' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<MyComp2<{ a: string; }, {}>> & { a: string; } & { children?: ReactNode; }'. tests/cases/conformance/jsx/file.tsx(47,53): error TS2339: Property 'b' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<MyComp2<{ a: string; }, {}>> & { a: string; } & { children?: {}; }'.
tests/cases/conformance/jsx/file.tsx(49,14): error TS2558: Expected 1-2 type arguments, but got 3. tests/cases/conformance/jsx/file.tsx(49,14): error TS2558: Expected 1-2 type arguments, but got 3.
tests/cases/conformance/jsx/file.tsx(49,53): error TS2339: Property 'b' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<MyComp2<{ a: string; }, {}>> & { a: string; } & { children?: ReactNode; }'. tests/cases/conformance/jsx/file.tsx(49,53): error TS2339: Property 'b' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<MyComp2<{ a: string; }, {}>> & { a: string; } & { children?: {}; }'.
tests/cases/conformance/jsx/file.tsx(51,47): error TS2326: Types of property 'b' are incompatible. tests/cases/conformance/jsx/file.tsx(51,47): error TS2326: Types of property 'b' are incompatible.
Type 'string' is not assignable to type 'number'. Type 'string' is not assignable to type 'number'.
tests/cases/conformance/jsx/file.tsx(53,47): error TS2326: Types of property 'b' are incompatible. tests/cases/conformance/jsx/file.tsx(53,47): error TS2326: Types of property 'b' are incompatible.
@ -101,13 +101,13 @@ tests/cases/conformance/jsx/file.tsx(53,47): error TS2326: Types of property 'b'
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2558: Expected 1-2 type arguments, but got 3. !!! error TS2558: Expected 1-2 type arguments, but got 3.
~~~~~~ ~~~~~~
!!! error TS2339: Property 'b' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<MyComp2<{ a: string; }, {}>> & { a: string; } & { children?: ReactNode; }'. !!! error TS2339: Property 'b' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<MyComp2<{ a: string; }, {}>> & { a: string; } & { children?: {}; }'.
x = <MyComp2<{a: string}, {b: string}, Prop> a="hi" b="hi"></MyComp2>; // error x = <MyComp2<{a: string}, {b: string}, Prop> a="hi" b="hi"></MyComp2>; // error
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2558: Expected 1-2 type arguments, but got 3. !!! error TS2558: Expected 1-2 type arguments, but got 3.
~~~~~~ ~~~~~~
!!! error TS2339: Property 'b' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<MyComp2<{ a: string; }, {}>> & { a: string; } & { children?: ReactNode; }'. !!! error TS2339: Property 'b' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<MyComp2<{ a: string; }, {}>> & { a: string; } & { children?: {}; }'.
x = <MyComp2<{a: string}, {b: number}> a="hi" b="hi" />; // error x = <MyComp2<{a: string}, {b: number}> a="hi" b="hi" />; // error
~~~~~~ ~~~~~~

View file

@ -1,7 +1,7 @@
tests/cases/conformance/jsx/file.tsx(32,17): error TS2326: Types of property 'x' are incompatible. tests/cases/conformance/jsx/file.tsx(32,17): error TS2326: Types of property 'x' are incompatible.
Type 'true' is not assignable to type 'ReactText'. Type 'true' is not assignable to type 'ReactText'.
tests/cases/conformance/jsx/file.tsx(33,10): error TS2559: Type '{ x: number; }' has no properties in common with type 'IntrinsicAttributes & IntrinsicClassAttributes<RC4> & { children?: ReactNode; }'. tests/cases/conformance/jsx/file.tsx(33,10): error TS2559: Type '{ x: number; }' has no properties in common with type 'IntrinsicAttributes & IntrinsicClassAttributes<RC4> & { children?: {}; }'.
tests/cases/conformance/jsx/file.tsx(34,10): error TS2559: Type '{ prop: true; }' has no properties in common with type 'IntrinsicAttributes & IntrinsicClassAttributes<RC3> & { children?: ReactNode; }'. tests/cases/conformance/jsx/file.tsx(34,10): error TS2559: Type '{ prop: true; }' has no properties in common with type 'IntrinsicAttributes & IntrinsicClassAttributes<RC3> & { children?: {}; }'.
==== tests/cases/conformance/jsx/file.tsx (3 errors) ==== ==== tests/cases/conformance/jsx/file.tsx (3 errors) ====
@ -42,8 +42,8 @@ tests/cases/conformance/jsx/file.tsx(34,10): error TS2559: Type '{ prop: true; }
!!! error TS2326: Type 'true' is not assignable to type 'ReactText'. !!! error TS2326: Type 'true' is not assignable to type 'ReactText'.
let b = <PartRCComp x={10} /> let b = <PartRCComp x={10} />
~~~~~~~~~~ ~~~~~~~~~~
!!! error TS2559: Type '{ x: number; }' has no properties in common with type 'IntrinsicAttributes & IntrinsicClassAttributes<RC4> & { children?: ReactNode; }'. !!! error TS2559: Type '{ x: number; }' has no properties in common with type 'IntrinsicAttributes & IntrinsicClassAttributes<RC4> & { children?: {}; }'.
let c = <EmptyRCComp prop />; let c = <EmptyRCComp prop />;
~~~~~~~~~~~ ~~~~~~~~~~~
!!! error TS2559: Type '{ prop: true; }' has no properties in common with type 'IntrinsicAttributes & IntrinsicClassAttributes<RC3> & { children?: ReactNode; }'. !!! error TS2559: Type '{ prop: true; }' has no properties in common with type 'IntrinsicAttributes & IntrinsicClassAttributes<RC3> & { children?: {}; }'.

View file

@ -25,9 +25,9 @@ class MyComponent extends React.Component<ComponentProps, {}> {
const { AnyComponent } = this.props; const { AnyComponent } = this.props;
>AnyComponent : React.StatelessComponent<any> | React.ComponentClass<any> >AnyComponent : React.StatelessComponent<any> | React.ComponentClass<any>
>this.props : ComponentProps & { children?: React.ReactNode; } >this.props : ComponentProps & { children?: {}; }
>this : this >this : this
>props : ComponentProps & { children?: React.ReactNode; } >props : ComponentProps & { children?: {}; }
return (<AnyComponent />); return (<AnyComponent />);
>(<AnyComponent />) : JSX.Element >(<AnyComponent />) : JSX.Element

View file

@ -16,9 +16,8 @@ tests/cases/compiler/tupleTypes.ts(47,1): error TS2322: Type '[number, string]'
Type 'string' is not assignable to type 'number'. Type 'string' is not assignable to type 'number'.
tests/cases/compiler/tupleTypes.ts(49,1): error TS2322: Type '[number, {}]' is not assignable to type 'number[]'. tests/cases/compiler/tupleTypes.ts(49,1): error TS2322: Type '[number, {}]' is not assignable to type 'number[]'.
Types of property 'pop' are incompatible. Types of property 'pop' are incompatible.
Type '() => number | {}' is not assignable to type '() => number'. Type '() => {}' is not assignable to type '() => number'.
Type 'number | {}' is not assignable to type 'number'. Type '{}' is not assignable to type 'number'.
Type '{}' is not assignable to type 'number'.
tests/cases/compiler/tupleTypes.ts(50,1): error TS2322: Type '[number, number]' is not assignable to type '[number, string]'. tests/cases/compiler/tupleTypes.ts(50,1): error TS2322: Type '[number, number]' is not assignable to type '[number, string]'.
Type 'number' is not assignable to type 'string'. Type 'number' is not assignable to type 'string'.
tests/cases/compiler/tupleTypes.ts(51,1): error TS2322: Type '[number, {}]' is not assignable to type '[number, string]'. tests/cases/compiler/tupleTypes.ts(51,1): error TS2322: Type '[number, {}]' is not assignable to type '[number, string]'.
@ -101,9 +100,8 @@ tests/cases/compiler/tupleTypes.ts(51,1): error TS2322: Type '[number, {}]' is n
~ ~
!!! error TS2322: Type '[number, {}]' is not assignable to type 'number[]'. !!! error TS2322: Type '[number, {}]' is not assignable to type 'number[]'.
!!! error TS2322: Types of property 'pop' are incompatible. !!! error TS2322: Types of property 'pop' are incompatible.
!!! error TS2322: Type '() => number | {}' is not assignable to type '() => number'. !!! error TS2322: Type '() => {}' is not assignable to type '() => number'.
!!! error TS2322: Type 'number | {}' is not assignable to type 'number'. !!! error TS2322: Type '{}' is not assignable to type 'number'.
!!! error TS2322: Type '{}' is not assignable to type 'number'.
a1 = a2; // Error a1 = a2; // Error
~~ ~~
!!! error TS2322: Type '[number, number]' is not assignable to type '[number, string]'. !!! error TS2322: Type '[number, number]' is not assignable to type '[number, string]'.

View file

@ -5,8 +5,8 @@ let promise1 = new Promise(function(resolve, reject) {})
>new Promise(function(resolve, reject) {}) .finally : (onfinally?: () => void) => Promise<{}> >new Promise(function(resolve, reject) {}) .finally : (onfinally?: () => void) => Promise<{}>
>new Promise(function(resolve, reject) {}) : Promise<{}> >new Promise(function(resolve, reject) {}) : Promise<{}>
>Promise : PromiseConstructor >Promise : PromiseConstructor
>function(resolve, reject) {} : (resolve: (value?: {} | PromiseLike<{}>) => void, reject: (reason?: any) => void) => void >function(resolve, reject) {} : (resolve: (value?: {}) => void, reject: (reason?: any) => void) => void
>resolve : (value?: {} | PromiseLike<{}>) => void >resolve : (value?: {}) => void
>reject : (reason?: any) => void >reject : (reason?: any) => void
.finally(function() {}); .finally(function() {});

View file

@ -9,7 +9,7 @@ const [r0, r1, r2, r3] = test.ranges();
const i = { definition: "(property) I.x: {}", ranges: [r0] }; const i = { definition: "(property) I.x: {}", ranges: [r0] };
const j = { definition: "(property) J.x: {}", ranges: [r1] }; const j = { definition: "(property) J.x: {}", ranges: [r1] };
const anon = { definition: "(property) x: string", ranges: [r2] }; const anon = { definition: "(property) x: string", ranges: [r2] };
const intersect = { definition: "(property) x: string & {}", ranges: [r3] }; const intersect = { definition: "(property) x: string", ranges: [r3] };
verify.referenceGroups(r0, [i, intersect]); verify.referenceGroups(r0, [i, intersect]);
verify.referenceGroups(r1, [j, intersect]); verify.referenceGroups(r1, [j, intersect]);
verify.referenceGroups(r2, [anon, intersect]); verify.referenceGroups(r2, [anon, intersect]);