Compare commits
11 commits
main
...
emptyObjec
Author | SHA1 | Date | |
---|---|---|---|
7247d8e33a | |||
ac6fa9ccee | |||
8666d39c59 | |||
3f5f8d7bd6 | |||
77bb4f89c0 | |||
0d9dc89a78 | |||
4c417833a9 | |||
2a19a4d81d | |||
1148cb0039 | |||
9e362b949e | |||
bac117d64d |
|
@ -372,11 +372,10 @@ namespace ts {
|
|||
const stringNumberSymbolType = getUnionType([stringType, numberType, esSymbolType]);
|
||||
const keyofConstraintType = keyofStringsOnly ? stringType : stringNumberSymbolType;
|
||||
|
||||
const emptyObjectType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined);
|
||||
|
||||
const emptyTypeLiteralSymbol = createSymbol(SymbolFlags.TypeLiteral, InternalSymbolName.Type);
|
||||
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);
|
||||
emptyGenericType.instantiations = createMap<TypeReference>();
|
||||
|
@ -448,6 +447,7 @@ namespace ts {
|
|||
let deferredGlobalTemplateStringsArrayType: ObjectType;
|
||||
let deferredGlobalImportMetaType: ObjectType;
|
||||
let deferredGlobalExtractSymbol: Symbol;
|
||||
let deferredTopType: Type;
|
||||
|
||||
let deferredNodes: Node[] | undefined;
|
||||
const allPotentiallyUnusedIdentifiers = createMap<PotentiallyUnusedIdentifier[]>(); // key is file name
|
||||
|
@ -8299,6 +8299,9 @@ namespace ts {
|
|||
else if (!strictNullChecks && flags & TypeFlags.Nullable) {
|
||||
if (!(flags & TypeFlags.ContainsWideningType)) includes |= TypeFlags.NonWideningType;
|
||||
}
|
||||
else if (getObjectFlags(type) & ObjectFlags.EmptyObjectType) {
|
||||
includes |= TypeFlags.EmptyObject;
|
||||
}
|
||||
else {
|
||||
const len = typeSet.length;
|
||||
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) {
|
||||
return types[0];
|
||||
}
|
||||
const typeSet: Type[] = [];
|
||||
let typeSet: Type[] = [];
|
||||
const includes = addTypesToUnion(typeSet, 0, types);
|
||||
if (includes & TypeFlags.Any) {
|
||||
return includes & TypeFlags.Wildcard ? wildcardType : anyType;
|
||||
}
|
||||
switch (unionReduction) {
|
||||
case UnionReduction.Literal:
|
||||
if (includes & TypeFlags.StringOrNumberLiteralOrUnique) {
|
||||
removeRedundantLiteralTypes(typeSet, includes);
|
||||
}
|
||||
break;
|
||||
case UnionReduction.Subtype:
|
||||
removeSubtypes(typeSet);
|
||||
break;
|
||||
if (includes & TypeFlags.EmptyObject) {
|
||||
if (!(strictNullChecks && includes & TypeFlags.Nullable)) {
|
||||
return emptyObjectType;
|
||||
}
|
||||
typeSet = !(includes & TypeFlags.Undefined) ? [nullType, emptyObjectType] :
|
||||
!(includes & TypeFlags.Null) ? [undefinedType, emptyObjectType] :
|
||||
[undefinedType, nullType, emptyObjectType];
|
||||
}
|
||||
else {
|
||||
switch (unionReduction) {
|
||||
case UnionReduction.Literal:
|
||||
if (includes & TypeFlags.StringOrNumberLiteralOrUnique) {
|
||||
removeRedundantLiteralTypes(typeSet, includes);
|
||||
}
|
||||
break;
|
||||
case UnionReduction.Subtype:
|
||||
removeSubtypes(typeSet);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (typeSet.length === 0) {
|
||||
return includes & TypeFlags.Null ? includes & TypeFlags.NonWideningType ? nullType : nullWideningType :
|
||||
|
@ -8498,6 +8511,10 @@ namespace ts {
|
|||
return links.resolvedType;
|
||||
}
|
||||
|
||||
function getTopType() {
|
||||
return deferredTopType || (deferredTopType = getUnionType([emptyObjectType, nullType, undefinedType]));
|
||||
}
|
||||
|
||||
function addTypeToIntersection(typeSet: Type[], includes: TypeFlags, type: Type) {
|
||||
const flags = type.flags;
|
||||
if (flags & TypeFlags.Intersection) {
|
||||
|
@ -8506,6 +8523,9 @@ namespace ts {
|
|||
if (getObjectFlags(type) & ObjectFlags.Anonymous && isEmptyObjectType(type)) {
|
||||
includes |= TypeFlags.EmptyObject;
|
||||
}
|
||||
else if (type.flags & TypeFlags.Union && type === getTopType()) {
|
||||
includes |= TypeFlags.TopUnion;
|
||||
}
|
||||
else {
|
||||
includes |= flags & ~TypeFlags.ConstructionFlags;
|
||||
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
|
||||
// for intersections of types with signatures can be deterministic.
|
||||
function getIntersectionType(types: Type[], aliasSymbol?: Symbol, aliasTypeArguments?: Type[]): Type {
|
||||
if (types.length === 0) {
|
||||
return emptyObjectType;
|
||||
}
|
||||
const typeSet: Type[] = [];
|
||||
const includes = addTypesToIntersection(typeSet, 0, types);
|
||||
if (includes & TypeFlags.Never) {
|
||||
|
@ -8590,12 +8607,18 @@ namespace ts {
|
|||
if (includes & TypeFlags.Any) {
|
||||
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 ||
|
||||
includes & TypeFlags.Number && includes & TypeFlags.NumberLiteral ||
|
||||
includes & TypeFlags.ESSymbol && includes & TypeFlags.UniqueESSymbol) {
|
||||
removeRedundantPrimitiveTypes(typeSet, includes);
|
||||
}
|
||||
if (includes & TypeFlags.EmptyObject && !(includes & TypeFlags.Object)) {
|
||||
if (includes & TypeFlags.EmptyObject && !(includes & TypeFlags.Object) && includes & TypeFlags.Nullable) {
|
||||
typeSet.push(emptyObjectType);
|
||||
}
|
||||
if (typeSet.length === 1) {
|
||||
|
@ -8961,6 +8984,9 @@ namespace ts {
|
|||
if (checkType === wildcardType || extendsType === 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
|
||||
// resolution of the conditional type such that a later instantiation will properly distribute
|
||||
// over union types.
|
||||
|
@ -9162,11 +9188,12 @@ namespace ts {
|
|||
if (!links.resolvedType) {
|
||||
// Deferred resolution of members is handled by resolveObjectTypeMembers
|
||||
const aliasSymbol = getAliasSymbolForTypeNode(node);
|
||||
if (getMembersOfSymbol(node.symbol).size === 0 && !aliasSymbol) {
|
||||
links.resolvedType = emptyTypeLiteralType;
|
||||
const isEmptyObjectLiteral = getMembersOfSymbol(node.symbol).size === 0;
|
||||
if (isEmptyObjectLiteral && !aliasSymbol) {
|
||||
links.resolvedType = emptyObjectType;
|
||||
}
|
||||
else {
|
||||
let type = createObjectType(ObjectFlags.Anonymous, node.symbol);
|
||||
let type = createObjectType(ObjectFlags.Anonymous | (isEmptyObjectLiteral ? ObjectFlags.EmptyObjectType : 0), node.symbol);
|
||||
type.aliasSymbol = aliasSymbol;
|
||||
type.aliasTypeArguments = getTypeArgumentsForAliasSymbol(aliasSymbol);
|
||||
if (isJSDocTypeLiteral(node) && node.isArrayType) {
|
||||
|
@ -9215,7 +9242,7 @@ namespace ts {
|
|||
const skippedPrivateMembers = createUnderscoreEscapedMap<boolean>();
|
||||
let stringIndexInfo: 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
|
||||
stringIndexInfo = getIndexInfoOfType(right, IndexKind.String);
|
||||
numberIndexInfo = getIndexInfoOfType(right, IndexKind.Number);
|
||||
|
@ -12888,7 +12915,9 @@ namespace ts {
|
|||
const constraint = getConstraintOfTypeParameter(inference.typeParameter);
|
||||
if (constraint) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -16233,7 +16262,7 @@ namespace ts {
|
|||
if (typeToIntersect && spread !== emptyObjectType) {
|
||||
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.
|
||||
|
@ -19387,7 +19416,7 @@ namespace ts {
|
|||
const decl = parameter.valueDeclaration as ParameterDeclaration;
|
||||
if (decl.name.kind !== SyntaxKind.Identifier) {
|
||||
// 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);
|
||||
}
|
||||
assignBindingElementTypes(decl.name);
|
||||
|
@ -19409,7 +19438,7 @@ namespace ts {
|
|||
|
||||
function createPromiseReturnType(func: FunctionLikeDeclaration | ImportCall, promisedType: Type) {
|
||||
const promiseType = createPromiseType(promisedType);
|
||||
if (promiseType === emptyObjectType) {
|
||||
if (getObjectFlags(promiseType) & ObjectFlags.EmptyObjectType) {
|
||||
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.An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option);
|
||||
|
|
|
@ -3687,17 +3687,17 @@ namespace ts {
|
|||
IndexedAccess = 1 << 20, // T[K]
|
||||
Conditional = 1 << 21, // T extends U ? X : Y
|
||||
Substitution = 1 << 22, // Type parameter substitution
|
||||
NonPrimitive = 1 << 23, // intrinsic object type
|
||||
/* @internal */
|
||||
FreshLiteral = 1 << 23, // Fresh literal or unique type
|
||||
FreshLiteral = 1 << 24, // Fresh literal or unique type
|
||||
/* @internal */
|
||||
ContainsWideningType = 1 << 24, // Type is or contains undefined or null widening type
|
||||
UnionOfUnitTypes = 1 << 25, // Type is union of unit types
|
||||
/* @internal */
|
||||
ContainsObjectLiteral = 1 << 25, // Type is or contains object literal type
|
||||
ContainsWideningType = 1 << 26, // Type is or contains undefined or null widening type
|
||||
/* @internal */
|
||||
ContainsAnyFunctionType = 1 << 26, // Type is or contains the anyFunctionType
|
||||
NonPrimitive = 1 << 27, // intrinsic object type
|
||||
ContainsObjectLiteral = 1 << 27, // Type is or contains object literal type
|
||||
/* @internal */
|
||||
UnionOfUnitTypes = 1 << 28, // Type is union of unit types
|
||||
ContainsAnyFunctionType = 1 << 28, // Type is or contains the anyFunctionType
|
||||
/* @internal */
|
||||
GenericMappedType = 1 << 29, // Flag used by maybeTypeOfKind
|
||||
|
||||
|
@ -3749,7 +3749,9 @@ namespace ts {
|
|||
/* @internal */
|
||||
EmptyObject = ContainsAnyFunctionType,
|
||||
/* @internal */
|
||||
ConstructionFlags = NonWideningType | Wildcard | EmptyObject
|
||||
TopUnion = GenericMappedType,
|
||||
/* @internal */
|
||||
ConstructionFlags = NonWideningType | Wildcard | EmptyObject | GenericMappedType
|
||||
}
|
||||
|
||||
export type DestructuringPattern = BindingPattern | ObjectLiteralExpression | ArrayLiteralExpression;
|
||||
|
@ -3813,6 +3815,7 @@ namespace ts {
|
|||
ReverseMapped = 1 << 11, // Object contains a property from a reverse-mapped type
|
||||
JsxAttributes = 1 << 12, // Jsx attributes type
|
||||
MarkerType = 1 << 13, // Marker type used for variance probing
|
||||
EmptyObjectType = 1 << 14, // Type is known to be empty object type {}
|
||||
ClassOrInterface = Class | Interface
|
||||
}
|
||||
|
||||
|
|
|
@ -2150,7 +2150,7 @@ declare namespace ts {
|
|||
IndexedAccess = 1048576,
|
||||
Conditional = 2097152,
|
||||
Substitution = 4194304,
|
||||
NonPrimitive = 134217728,
|
||||
NonPrimitive = 8388608,
|
||||
Literal = 224,
|
||||
Unit = 13536,
|
||||
StringOrNumberLiteral = 96,
|
||||
|
@ -2168,8 +2168,8 @@ declare namespace ts {
|
|||
InstantiablePrimitive = 524288,
|
||||
Instantiable = 7897088,
|
||||
StructuredOrInstantiable = 8355840,
|
||||
Narrowable = 142575359,
|
||||
NotUnionOrUnit = 134283777
|
||||
Narrowable = 16746239,
|
||||
NotUnionOrUnit = 8454657
|
||||
}
|
||||
type DestructuringPattern = BindingPattern | ObjectLiteralExpression | ArrayLiteralExpression;
|
||||
interface Type {
|
||||
|
@ -2210,6 +2210,7 @@ declare namespace ts {
|
|||
ReverseMapped = 2048,
|
||||
JsxAttributes = 4096,
|
||||
MarkerType = 8192,
|
||||
EmptyObjectType = 16384,
|
||||
ClassOrInterface = 3
|
||||
}
|
||||
interface ObjectType extends Type {
|
||||
|
|
|
@ -2150,7 +2150,7 @@ declare namespace ts {
|
|||
IndexedAccess = 1048576,
|
||||
Conditional = 2097152,
|
||||
Substitution = 4194304,
|
||||
NonPrimitive = 134217728,
|
||||
NonPrimitive = 8388608,
|
||||
Literal = 224,
|
||||
Unit = 13536,
|
||||
StringOrNumberLiteral = 96,
|
||||
|
@ -2168,8 +2168,8 @@ declare namespace ts {
|
|||
InstantiablePrimitive = 524288,
|
||||
Instantiable = 7897088,
|
||||
StructuredOrInstantiable = 8355840,
|
||||
Narrowable = 142575359,
|
||||
NotUnionOrUnit = 134283777
|
||||
Narrowable = 16746239,
|
||||
NotUnionOrUnit = 8454657
|
||||
}
|
||||
type DestructuringPattern = BindingPattern | ObjectLiteralExpression | ArrayLiteralExpression;
|
||||
interface Type {
|
||||
|
@ -2210,6 +2210,7 @@ declare namespace ts {
|
|||
ReverseMapped = 2048,
|
||||
JsxAttributes = 4096,
|
||||
MarkerType = 8192,
|
||||
EmptyObjectType = 16384,
|
||||
ClassOrInterface = 3
|
||||
}
|
||||
interface ObjectType extends Type {
|
||||
|
|
|
@ -23,7 +23,7 @@ interface IAsyncEnumerator<T> {
|
|||
>AsyncEnumeratorDone : AsyncEnumeratorDone
|
||||
|
||||
next3(): Promise<T | {}>;
|
||||
>next3 : () => Promise<{} | T>
|
||||
>next3 : () => Promise<{}>
|
||||
>Promise : Promise<T>
|
||||
>T : T
|
||||
|
||||
|
@ -59,12 +59,12 @@ async function main() {
|
|||
>next2 : () => Promise<AsyncEnumeratorDone> | Promise<number>
|
||||
|
||||
let c = await x.next3();
|
||||
>c : number | {}
|
||||
>await x.next3() : number | {}
|
||||
>x.next3() : Promise<number | {}>
|
||||
>x.next3 : () => Promise<number | {}>
|
||||
>c : {}
|
||||
>await x.next3() : {}
|
||||
>x.next3() : Promise<{}>
|
||||
>x.next3 : () => Promise<{}>
|
||||
>x : IAsyncEnumerator<number>
|
||||
>next3 : () => Promise<number | {}>
|
||||
>next3 : () => Promise<{}>
|
||||
|
||||
let d = await x.next4();
|
||||
>d : number | { x: string; }
|
||||
|
|
|
@ -35,18 +35,18 @@ class Button extends React.Component<ButtonProp, any> {
|
|||
return <InnerButton {...this.props} />
|
||||
><InnerButton {...this.props} /> : JSX.Element
|
||||
>InnerButton : typeof InnerButton
|
||||
>this.props : ButtonProp & { children?: React.ReactNode; }
|
||||
>this.props : ButtonProp & { children?: {}; }
|
||||
>this : this
|
||||
>props : ButtonProp & { children?: React.ReactNode; }
|
||||
>props : ButtonProp & { children?: {}; }
|
||||
}
|
||||
else {
|
||||
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 : typeof InnerButton
|
||||
>this.props : ButtonProp & { children?: React.ReactNode; }
|
||||
>this.props : ButtonProp & { children?: {}; }
|
||||
>this : this
|
||||
>props : ButtonProp & { children?: React.ReactNode; }
|
||||
>props : ButtonProp & { children?: {}; }
|
||||
|
||||
<div>Hello World</div>
|
||||
><div>Hello World</div> : JSX.Element
|
||||
|
|
|
@ -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 : typeof InnerButton
|
||||
>this.props : ButtonProp & { children?: React.ReactNode; }
|
||||
>this.props : ButtonProp & { children?: {}; }
|
||||
>this : this
|
||||
>props : ButtonProp & { children?: React.ReactNode; }
|
||||
>props : ButtonProp & { children?: {}; }
|
||||
>children : string
|
||||
|
||||
<div>Hello World</div>
|
||||
|
|
|
@ -38,11 +38,11 @@ class FetchUser extends React.Component<IFetchUserProps, any> {
|
|||
|
||||
? this.props.children(this.state.result)
|
||||
>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 : IFetchUserProps & { children?: React.ReactNode; }
|
||||
>this.props.children : (user: IUser) => JSX.Element
|
||||
>this.props : IFetchUserProps & { children?: {}; }
|
||||
>this : this
|
||||
>props : IFetchUserProps & { children?: React.ReactNode; }
|
||||
>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>)[])
|
||||
>props : IFetchUserProps & { children?: {}; }
|
||||
>children : (user: IUser) => JSX.Element
|
||||
>this.state.result : any
|
||||
>this.state : any
|
||||
>this : this
|
||||
|
|
|
@ -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(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'.
|
||||
Types of property 'children' are incompatible.
|
||||
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 (
|
||||
<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: Types of property 'children' are incompatible.
|
||||
!!! error TS2322: Type '((user: IUser) => Element)[]' is not assignable to type '(user: IUser) => Element'.
|
||||
|
|
|
@ -38,11 +38,11 @@ class FetchUser extends React.Component<IFetchUserProps, any> {
|
|||
|
||||
? this.props.children(this.state.result)
|
||||
>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 : IFetchUserProps & { children?: React.ReactNode; }
|
||||
>this.props.children : (user: IUser) => JSX.Element
|
||||
>this.props : IFetchUserProps & { children?: {}; }
|
||||
>this : this
|
||||
>props : IFetchUserProps & { children?: React.ReactNode; }
|
||||
>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>)[])
|
||||
>props : IFetchUserProps & { children?: {}; }
|
||||
>children : (user: IUser) => JSX.Element
|
||||
>this.state.result : any
|
||||
>this.state : any
|
||||
>this : this
|
||||
|
|
|
@ -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'.
|
||||
}
|
||||
|
|
@ -19,10 +19,6 @@ if (`test` in obj) {
|
|||
>obj : Symbol(obj, Decl(controlFlowWithTemplateLiterals.ts, 5, 13))
|
||||
|
||||
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))
|
||||
>test : Symbol(test, Decl(controlFlowWithTemplateLiterals.ts, 5, 20))
|
||||
>slice : Symbol(String.slice, Decl(lib.d.ts, --, --))
|
||||
}
|
||||
|
||||
|
|
|
@ -17,21 +17,21 @@ if (typeof envVar === `string`) {
|
|||
}
|
||||
|
||||
declare const obj: {test: string} | {}
|
||||
>obj : {} | { test: string; }
|
||||
>obj : {}
|
||||
>test : string
|
||||
|
||||
if (`test` in obj) {
|
||||
>`test` in obj : boolean
|
||||
>`test` : "test"
|
||||
>obj : {} | { test: string; }
|
||||
>obj : {}
|
||||
|
||||
obj.test.slice(0)
|
||||
>obj.test.slice(0) : string
|
||||
>obj.test.slice : (start?: number | undefined, end?: number | undefined) => string
|
||||
>obj.test : string
|
||||
>obj : { test: string; }
|
||||
>test : string
|
||||
>slice : (start?: number | undefined, end?: number | undefined) => string
|
||||
>obj.test.slice(0) : any
|
||||
>obj.test.slice : any
|
||||
>obj.test : any
|
||||
>obj : never
|
||||
>test : any
|
||||
>slice : any
|
||||
>0 : 0
|
||||
}
|
||||
|
||||
|
|
|
@ -3,11 +3,11 @@ const x = new Promise( ( resolve, reject ) => { resolve( {} ); } );
|
|||
>x : Promise<{}>
|
||||
>new Promise( ( resolve, reject ) => { resolve( {} ); } ) : Promise<{}>
|
||||
>Promise : PromiseConstructor
|
||||
>( resolve, reject ) => { resolve( {} ); } : (resolve: (value?: {} | PromiseLike<{}>) => void, reject: (reason?: any) => void) => void
|
||||
>resolve : (value?: {} | PromiseLike<{}>) => void
|
||||
>( resolve, reject ) => { resolve( {} ); } : (resolve: (value?: {}) => void, reject: (reason?: any) => void) => void
|
||||
>resolve : (value?: {}) => void
|
||||
>reject : (reason?: any) => void
|
||||
>resolve( {} ) : void
|
||||
>resolve : (value?: {} | PromiseLike<{}>) => void
|
||||
>resolve : (value?: {}) => void
|
||||
>{} : {}
|
||||
|
||||
export default x;
|
||||
|
|
|
@ -3,11 +3,11 @@ const x = new Promise( ( resolve, reject ) => { resolve( {} ); } );
|
|||
>x : Promise<{}>
|
||||
>new Promise( ( resolve, reject ) => { resolve( {} ); } ) : Promise<{}>
|
||||
>Promise : PromiseConstructor
|
||||
>( resolve, reject ) => { resolve( {} ); } : (resolve: (value?: {} | PromiseLike<{}>) => void, reject: (reason?: any) => void) => void
|
||||
>resolve : (value?: {} | PromiseLike<{}>) => void
|
||||
>( resolve, reject ) => { resolve( {} ); } : (resolve: (value?: {}) => void, reject: (reason?: any) => void) => void
|
||||
>resolve : (value?: {}) => void
|
||||
>reject : (reason?: any) => void
|
||||
>resolve( {} ) : void
|
||||
>resolve : (value?: {} | PromiseLike<{}>) => void
|
||||
>resolve : (value?: {}) => void
|
||||
>{} : {}
|
||||
|
||||
export default x;
|
||||
|
|
|
@ -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'.
|
||||
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(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,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.
|
||||
|
@ -23,7 +23,7 @@ tests/cases/conformance/es6/destructuring/destructuringObjectBindingPatternAndAs
|
|||
!!! error TS2459: Type 'string | number' has no property 'i' and no string index signature.
|
||||
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;
|
||||
~~~
|
||||
!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
|
|
|
@ -9,7 +9,7 @@ class A<T extends Object>{
|
|||
>T : T
|
||||
}
|
||||
var a = new A();
|
||||
>a : A<{}>
|
||||
>new A() : A<{}>
|
||||
>a : A<Object>
|
||||
>new A() : A<Object>
|
||||
>A : typeof A
|
||||
|
||||
|
|
|
@ -24,14 +24,14 @@ var r = foo(1); // ok
|
|||
>1 : 1
|
||||
|
||||
var r2 = foo(null); // {}
|
||||
>r2 : {}
|
||||
>foo(null) : {}
|
||||
>r2 : any
|
||||
>foo(null) : any
|
||||
>foo : <T, U extends T>(t: T) => U
|
||||
>null : null
|
||||
|
||||
var r3 = foo(new Object()); // {}
|
||||
>r3 : {}
|
||||
>foo(new Object()) : {}
|
||||
>r3 : Object
|
||||
>foo(new Object()) : Object
|
||||
>foo : <T, U extends T>(t: T) => U
|
||||
>new Object() : Object
|
||||
>Object : ObjectConstructor
|
||||
|
|
|
@ -1004,7 +1004,7 @@ declare function f11<T, U = T | B>(a?: T, b?: U): [T, U];
|
|||
|
||||
// inference
|
||||
f11();
|
||||
>f11() : [{}, {} | B]
|
||||
>f11() : [{}, {}]
|
||||
>f11 : <T, U = B | T>(a?: T, b?: U) => [T, U]
|
||||
|
||||
f11(a);
|
||||
|
@ -1607,7 +1607,7 @@ declare function f17<T = U, U = T | B>(a?: T, b?: U): [T, U];
|
|||
|
||||
// inference
|
||||
f17();
|
||||
>f17() : [{}, {} | B]
|
||||
>f17() : [{}, {}]
|
||||
>f17 : <T = U, U = B | T>(a?: T, b?: U) => [T, U]
|
||||
|
||||
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
|
||||
f18();
|
||||
>f18() : [{}, {}, {} | C]
|
||||
>f18() : [{}, {}, {}]
|
||||
>f18 : <T, U = V, V = C | U>(a?: T, b?: U, c?: V) => [T, U, V]
|
||||
|
||||
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]
|
||||
>a : A
|
||||
|
||||
|
@ -1732,25 +1732,25 @@ f18(a, b, c);
|
|||
|
||||
// no inference, partially supplied
|
||||
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]
|
||||
>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]
|
||||
>A : A
|
||||
>a : A
|
||||
|
||||
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]
|
||||
>A : A
|
||||
>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]
|
||||
>A : A
|
||||
>a : A
|
||||
|
@ -1758,7 +1758,7 @@ f18<A>(a, b, b);
|
|||
>b : B
|
||||
|
||||
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]
|
||||
>A : A
|
||||
>a : A
|
||||
|
|
|
@ -113,14 +113,14 @@ interface O {
|
|||
}
|
||||
|
||||
type NonIndexableUnion = boolean | {};
|
||||
>NonIndexableUnion : NonIndexableUnion
|
||||
>NonIndexableUnion : {}
|
||||
|
||||
interface P {
|
||||
>P : P
|
||||
|
||||
[u: NonIndexableUnion]: A;
|
||||
>u : NonIndexableUnion
|
||||
>NonIndexableUnion : NonIndexableUnion
|
||||
>u : {}
|
||||
>NonIndexableUnion : {}
|
||||
>A : A
|
||||
}
|
||||
|
||||
|
|
|
@ -40,8 +40,8 @@ export class BrokenClass {
|
|||
return new Promise((resolve, reject) => {
|
||||
>new Promise((resolve, reject) => { this.doStuff(order.id) .then((items) => { order.items = items; resolve(order); }); }) : Promise<{}>
|
||||
>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 : (value?: {} | PromiseLike<{}>) => void
|
||||
>(resolve, reject) => { this.doStuff(order.id) .then((items) => { order.items = items; resolve(order); }); } : (resolve: (value?: {}) => void, reject: (reason?: any) => void) => void
|
||||
>resolve : (value?: {}) => void
|
||||
>reject : (reason?: any) => void
|
||||
|
||||
this.doStuff(order.id)
|
||||
|
@ -69,7 +69,7 @@ export class BrokenClass {
|
|||
|
||||
resolve(order);
|
||||
>resolve(order) : void
|
||||
>resolve : (value?: {} | PromiseLike<{}>) => void
|
||||
>resolve : (value?: {}) => void
|
||||
>order : any
|
||||
|
||||
});
|
||||
|
|
|
@ -35,11 +35,11 @@ let x04: A & B & C;
|
|||
>C : C
|
||||
|
||||
let x05: string & C;
|
||||
>x05 : string & {}
|
||||
>x05 : string
|
||||
>C : C
|
||||
|
||||
let x06: C & string;
|
||||
>x06 : string & {}
|
||||
>x06 : string
|
||||
>C : C
|
||||
|
||||
let x07: C;
|
||||
|
|
|
@ -138,8 +138,8 @@ async function out() {
|
|||
return new Promise(function (resolve, reject) {});
|
||||
>new Promise(function (resolve, reject) {}) : Promise<{}>
|
||||
>Promise : PromiseConstructor
|
||||
>function (resolve, reject) {} : (resolve: (value?: {} | PromiseLike<{}>) => void, reject: (reason?: any) => void) => void
|
||||
>resolve : (value?: {} | PromiseLike<{}>) => void
|
||||
>function (resolve, reject) {} : (resolve: (value?: {}) => void, reject: (reason?: any) => void) => void
|
||||
>resolve : (value?: {}) => void
|
||||
>reject : (reason?: any) => void
|
||||
}
|
||||
|
||||
|
|
|
@ -138,8 +138,8 @@ async function out() {
|
|||
return new Promise(function (resolve, reject) {});
|
||||
>new Promise(function (resolve, reject) {}) : Promise<{}>
|
||||
>Promise : PromiseConstructor
|
||||
>function (resolve, reject) {} : (resolve: (value?: {} | PromiseLike<{}>) => void, reject: (reason?: any) => void) => void
|
||||
>resolve : (value?: {} | PromiseLike<{}>) => void
|
||||
>function (resolve, reject) {} : (resolve: (value?: {}) => void, reject: (reason?: any) => void) => void
|
||||
>resolve : (value?: {}) => void
|
||||
>reject : (reason?: any) => void
|
||||
}
|
||||
|
||||
|
|
|
@ -138,8 +138,8 @@ async function out() {
|
|||
return new Promise(function (resolve, reject) {});
|
||||
>new Promise(function (resolve, reject) {}) : Promise<{}>
|
||||
>Promise : PromiseConstructor
|
||||
>function (resolve, reject) {} : (resolve: (value?: {} | PromiseLike<{}>) => void, reject: (reason?: any) => void) => void
|
||||
>resolve : (value?: {} | PromiseLike<{}>) => void
|
||||
>function (resolve, reject) {} : (resolve: (value?: {}) => void, reject: (reason?: any) => void) => void
|
||||
>resolve : (value?: {}) => void
|
||||
>reject : (reason?: any) => void
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
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'.
|
||||
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(3,5): error TS2322: 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'.
|
||||
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; }'.
|
||||
|
@ -16,8 +15,7 @@ tests/cases/conformance/types/nonPrimitive/nonPrimitiveUnionIntersection.ts(8,38
|
|||
var b: object | string = ""; // ok
|
||||
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
|
||||
~
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'object & string'.
|
||||
|
|
|
@ -8,7 +8,7 @@ var b: object | string = ""; // ok
|
|||
>"" : ""
|
||||
|
||||
var c: object & {} = 123; // error
|
||||
>c : object & {}
|
||||
>c : object
|
||||
>123 : 123
|
||||
|
||||
a = b; // error
|
||||
|
@ -22,7 +22,7 @@ b = a; // ok
|
|||
>a : object & string
|
||||
|
||||
const foo: object & {} = {bar: 'bar'}; // ok
|
||||
>foo : object & {}
|
||||
>foo : object
|
||||
>{bar: 'bar'} : { bar: string; }
|
||||
>bar : string
|
||||
>'bar' : "bar"
|
||||
|
|
|
@ -296,7 +296,7 @@ function conditionalSpreadBoolean(b: boolean) : { x: number, y: number } {
|
|||
}
|
||||
let o2 = { ...b && { x: 21 }}
|
||||
>o2 : {}
|
||||
>{ ...b && { x: 21 }} : {} | { x: number; }
|
||||
>{ ...b && { x: 21 }} : {}
|
||||
>b && { x: 21 } : false | { x: number; }
|
||||
>b : boolean
|
||||
>{ x: 21 } : { x: number; }
|
||||
|
@ -337,7 +337,7 @@ function conditionalSpreadNumber(nt: number): { x: number, y: number } {
|
|||
}
|
||||
let o2 = { ...nt && { x: nt }}
|
||||
>o2 : {}
|
||||
>{ ...nt && { x: nt }} : {} | { x: number; }
|
||||
>{ ...nt && { x: nt }} : {}
|
||||
>nt && { x: nt } : 0 | { x: number; }
|
||||
>nt : number
|
||||
>{ x: nt } : { x: number; }
|
||||
|
@ -378,7 +378,7 @@ function conditionalSpreadString(st: string): { x: string, y: number } {
|
|||
}
|
||||
let o2 = { ...st && { x: st }}
|
||||
>o2 : {}
|
||||
>{ ...st && { x: st }} : {} | { x: string; }
|
||||
>{ ...st && { x: st }} : {}
|
||||
>st && { x: st } : "" | { x: string; }
|
||||
>st : string
|
||||
>{ x: st } : { x: string; }
|
||||
|
|
|
@ -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 '{}'.
|
||||
|
||||
|
|
@ -9,58 +9,58 @@ declare const nullUnion: { b: number } | null;
|
|||
>null : null
|
||||
|
||||
var o1: {} | { a: number };
|
||||
>o1 : {} | { a: number; }
|
||||
>o1 : {}
|
||||
>a : number
|
||||
|
||||
var o1 = { ...undefinedUnion };
|
||||
>o1 : {} | { a: number; }
|
||||
>o1 : {}
|
||||
>{ ...undefinedUnion } : {} | { a: number; }
|
||||
>undefinedUnion : { a: number; } | undefined
|
||||
|
||||
var o2: {} | { b: number };
|
||||
>o2 : {} | { b: number; }
|
||||
>o2 : {}
|
||||
>b : number
|
||||
|
||||
var o2 = { ...nullUnion };
|
||||
>o2 : {} | { b: number; }
|
||||
>o2 : {}
|
||||
>{ ...nullUnion } : {} | { b: number; }
|
||||
>nullUnion : { b: number; } | null
|
||||
|
||||
var o3: {} | { a: number } | { b: number } | { a: number, b: number };
|
||||
>o3 : {} | { a: number; } | { b: number; } | { a: number; b: number; }
|
||||
>o3 : {}
|
||||
>a : number
|
||||
>b : number
|
||||
>a : number
|
||||
>b : number
|
||||
|
||||
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 : { a: number; } | undefined
|
||||
>nullUnion : { b: number; } | null
|
||||
|
||||
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 : { b: number; } | null
|
||||
>undefinedUnion : { a: number; } | undefined
|
||||
|
||||
var o4: {} | { a: number };
|
||||
>o4 : {} | { a: number; }
|
||||
>o4 : {}
|
||||
>a : number
|
||||
|
||||
var o4 = { ...undefinedUnion, ...undefinedUnion };
|
||||
>o4 : {} | { a: number; }
|
||||
>o4 : {}
|
||||
>{ ...undefinedUnion, ...undefinedUnion } : {} | { a: number; } | { a: number; } | { a: number; }
|
||||
>undefinedUnion : { a: number; } | undefined
|
||||
>undefinedUnion : { a: number; } | undefined
|
||||
|
||||
var o5: {} | { b: number };
|
||||
>o5 : {} | { b: number; }
|
||||
>o5 : {}
|
||||
>b : number
|
||||
|
||||
var o5 = { ...nullUnion, ...nullUnion };
|
||||
>o5 : {} | { b: number; }
|
||||
>o5 : {}
|
||||
>{ ...nullUnion, ...nullUnion } : {} | { b: number; } | { b: number; } | { b: number; }
|
||||
>nullUnion : { b: number; } | null
|
||||
>nullUnion : { b: number; } | null
|
||||
|
|
|
@ -77,10 +77,12 @@ extend1({
|
|||
>foo : Symbol(foo, Decl(thisTypeInFunctions2.ts, 26, 13))
|
||||
|
||||
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 : 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({
|
||||
|
|
|
@ -58,7 +58,7 @@ declare function simple(arg: SimpleInterface): void;
|
|||
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 : (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 : (this: IndexedWithThis) => void
|
||||
|
@ -78,17 +78,17 @@ extend1({
|
|||
>12 : 12
|
||||
|
||||
foo() {
|
||||
>foo : (this: any) => void
|
||||
>foo : () => void
|
||||
|
||||
this.url; // this: any because 'foo' matches the string indexer
|
||||
>this.url : any
|
||||
>this : any
|
||||
>url : any
|
||||
>this.url : {}
|
||||
>this : IndexedWithThis
|
||||
>url : {}
|
||||
|
||||
this.willDestroy;
|
||||
>this.willDestroy : any
|
||||
>this : any
|
||||
>willDestroy : any
|
||||
>this.willDestroy : (this: any) => void
|
||||
>this : IndexedWithThis
|
||||
>willDestroy : (this: any) => void
|
||||
}
|
||||
});
|
||||
extend2({
|
||||
|
|
|
@ -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) ====
|
||||
|
@ -14,7 +14,7 @@ tests/cases/conformance/jsx/file.tsx(11,10): error TS2559: Type '{ prop1: string
|
|||
// Error
|
||||
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
|
||||
let b = <BigGreeter ref={(input) => { this.textInput = input; }} />
|
||||
|
|
|
@ -15,11 +15,11 @@ const decorator = function <T>(Component: React.StatelessComponent<T>): React.St
|
|||
>T : T
|
||||
|
||||
return (props) => <Component {...props}></Component>
|
||||
>(props) => <Component {...props}></Component> : (props: T & { children?: React.ReactNode; }) => JSX.Element
|
||||
>props : T & { children?: React.ReactNode; }
|
||||
>(props) => <Component {...props}></Component> : (props: T & { children?: {}; }) => JSX.Element
|
||||
>props : T & { children?: {}; }
|
||||
><Component {...props}></Component> : JSX.Element
|
||||
>Component : React.StatelessComponent<T>
|
||||
>props : T & { children?: React.ReactNode; }
|
||||
>props : T & { children?: {}; }
|
||||
>Component : React.StatelessComponent<T>
|
||||
|
||||
};
|
||||
|
@ -38,11 +38,11 @@ const decorator2 = function <T extends { x: number }>(Component: React.Stateless
|
|||
>T : T
|
||||
|
||||
return (props) => <Component {...props} x={2} ></Component>
|
||||
>(props) => <Component {...props} x={2} ></Component> : (props: T & { children?: React.ReactNode; }) => JSX.Element
|
||||
>props : T & { children?: React.ReactNode; }
|
||||
>(props) => <Component {...props} x={2} ></Component> : (props: T & { children?: {}; }) => JSX.Element
|
||||
>props : T & { children?: {}; }
|
||||
><Component {...props} x={2} ></Component> : JSX.Element
|
||||
>Component : React.StatelessComponent<T>
|
||||
>props : T & { children?: React.ReactNode; }
|
||||
>props : T & { children?: {}; }
|
||||
>x : number
|
||||
>2 : 2
|
||||
>Component : React.StatelessComponent<T>
|
||||
|
@ -65,13 +65,13 @@ const decorator3 = function <T extends { x: number }, U extends { x: number } >(
|
|||
>T : T
|
||||
|
||||
return (props) => <Component x={2} {...props} ></Component>
|
||||
>(props) => <Component x={2} {...props} ></Component> : (props: T & { children?: React.ReactNode; }) => JSX.Element
|
||||
>props : T & { children?: React.ReactNode; }
|
||||
>(props) => <Component x={2} {...props} ></Component> : (props: T & { children?: {}; }) => JSX.Element
|
||||
>props : T & { children?: {}; }
|
||||
><Component x={2} {...props} ></Component> : JSX.Element
|
||||
>Component : React.StatelessComponent<T>
|
||||
>x : number
|
||||
>2 : 2
|
||||
>props : T & { children?: React.ReactNode; }
|
||||
>props : T & { children?: {}; }
|
||||
>Component : React.StatelessComponent<T>
|
||||
|
||||
};
|
||||
|
|
|
@ -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) ====
|
||||
|
@ -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> {
|
||||
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?: {}; }'.
|
||||
};
|
|
@ -16,11 +16,11 @@ const decorator4 = function <T extends { x: number }>(Component: React.Stateless
|
|||
>T : T
|
||||
|
||||
return (props) => <Component {...props} y={"blah"} ></Component>
|
||||
>(props) => <Component {...props} y={"blah"} ></Component> : (props: T & { children?: React.ReactNode; }) => JSX.Element
|
||||
>props : T & { children?: React.ReactNode; }
|
||||
>(props) => <Component {...props} y={"blah"} ></Component> : (props: T & { children?: {}; }) => JSX.Element
|
||||
>props : T & { children?: {}; }
|
||||
><Component {...props} y={"blah"} ></Component> : JSX.Element
|
||||
>Component : React.StatelessComponent<T>
|
||||
>props : T & { children?: React.ReactNode; }
|
||||
>props : T & { children?: {}; }
|
||||
>y : string
|
||||
>"blah" : "blah"
|
||||
>Component : React.StatelessComponent<T>
|
||||
|
|
|
@ -35,9 +35,9 @@ class B<U> extends React.Component<U, {}> {
|
|||
return <B1 {...this.props} x="hi" />;
|
||||
><B1 {...this.props} x="hi" /> : JSX.Element
|
||||
>B1 : typeof B1
|
||||
>this.props : U & { children?: React.ReactNode; }
|
||||
>this.props : U & { children?: {}; }
|
||||
>this : this
|
||||
>props : U & { children?: React.ReactNode; }
|
||||
>props : U & { children?: {}; }
|
||||
>x : string
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,9 +34,9 @@ class B<U> extends React.Component<U, {}> {
|
|||
return <B1 {...this.props} x="hi" />;
|
||||
><B1 {...this.props} x="hi" /> : JSX.Element
|
||||
>B1 : typeof B1
|
||||
>this.props : U & { children?: React.ReactNode; }
|
||||
>this.props : U & { children?: {}; }
|
||||
>this : this
|
||||
>props : U & { children?: React.ReactNode; }
|
||||
>props : U & { children?: {}; }
|
||||
>x : string
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,9 +28,9 @@ export function makeP<P>(Ctor: React.ComponentClass<P>) {
|
|||
<Ctor {...this.props } />
|
||||
><Ctor {...this.props } /> : JSX.Element
|
||||
>Ctor : React.ComponentClass<P>
|
||||
>this.props : P & { children?: React.ReactNode; }
|
||||
>this.props : P & { children?: {}; }
|
||||
>this : this
|
||||
>props : P & { children?: React.ReactNode; }
|
||||
>props : P & { children?: {}; }
|
||||
|
||||
);
|
||||
}
|
||||
|
|
|
@ -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'.
|
||||
Property 'a' is missing in type '{}'.
|
||||
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
|
||||
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: Property 'a' is missing in type '{}'.
|
||||
|
||||
|
|
|
@ -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'.
|
||||
tests/cases/conformance/jsx/file.tsx(28,50): error TS2326: Types of property 'x' are incompatible.
|
||||
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'.
|
||||
Types of property 'y' are incompatible.
|
||||
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 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: Types of property 'y' are incompatible.
|
||||
!!! error TS2322: Type 'true' is not assignable to type 'false'.
|
||||
|
|
|
@ -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'.
|
||||
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'.
|
||||
Property 'x' is missing in type '{}'.
|
||||
tests/cases/conformance/jsx/file.tsx(19,19): error TS2326: Types of property 'x' are incompatible.
|
||||
Type 'true' is not assignable to type 'string'.
|
||||
tests/cases/conformance/jsx/file.tsx(19,21): error TS2326: Types of property 'y' are incompatible.
|
||||
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'.
|
||||
Types of property 'x' are incompatible.
|
||||
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'.
|
||||
Types of property 'x' are incompatible.
|
||||
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
|
||||
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: Property 'x' is missing in type '{}'.
|
||||
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: Property 'x' is missing in type '{}'.
|
||||
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"'.
|
||||
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: Types of property 'x' are incompatible.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
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: Types of property 'x' are incompatible.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
|
@ -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'.
|
||||
Types of property 'y' are incompatible.
|
||||
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) ====
|
||||
|
@ -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 }
|
||||
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: Types of property 'y' are incompatible.
|
||||
!!! 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
|
||||
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?: {}; }'.
|
|
@ -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; })'.
|
||||
Type '{ editable: true; }' is not assignable to type '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?: {}; }'.
|
||||
Type '{ editable: true; }' is not assignable to type '{ editable: true; onEdit: (newText: string) => void; }'.
|
||||
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
|
||||
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: 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?: {}; }'.
|
||||
!!! 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; }'.
|
||||
|
||||
|
|
|
@ -21,8 +21,8 @@ var MainMenu: React.StatelessComponent<{}> = (props) => (<div>
|
|||
>MainMenu : React.StatelessComponent<{}>
|
||||
>React : any
|
||||
>StatelessComponent : React.StatelessComponent<P>
|
||||
>(props) => (<div> <h3>Main Menu</h3></div>) : (props: { children?: React.ReactNode; }) => JSX.Element
|
||||
>props : { children?: React.ReactNode; }
|
||||
>(props) => (<div> <h3>Main Menu</h3></div>) : (props: { children?: {}; }) => JSX.Element
|
||||
>props : { children?: {}; }
|
||||
>(<div> <h3>Main Menu</h3></div>) : JSX.Element
|
||||
><div> <h3>Main Menu</h3></div> : JSX.Element
|
||||
>div : any
|
||||
|
@ -40,7 +40,7 @@ var App: React.StatelessComponent<{ children }> = ({children}) => (
|
|||
>React : any
|
||||
>StatelessComponent : React.StatelessComponent<P>
|
||||
>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
|
||||
>( <div > <MainMenu/> </div>) : JSX.Element
|
||||
|
||||
|
|
|
@ -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.
|
||||
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,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,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.
|
||||
Type 'string' is not assignable to type 'number'.
|
||||
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 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
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! 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
|
||||
~~~~~~
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
tests/cases/conformance/jsx/file.tsx(32,17): error TS2326: Types of property 'x' are incompatible.
|
||||
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(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(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?: {}; }'.
|
||||
|
||||
|
||||
==== 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'.
|
||||
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 />;
|
||||
~~~~~~~~~~~
|
||||
!!! 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?: {}; }'.
|
||||
|
|
@ -25,9 +25,9 @@ class MyComponent extends React.Component<ComponentProps, {}> {
|
|||
|
||||
const { AnyComponent } = this.props;
|
||||
>AnyComponent : React.StatelessComponent<any> | React.ComponentClass<any>
|
||||
>this.props : ComponentProps & { children?: React.ReactNode; }
|
||||
>this.props : ComponentProps & { children?: {}; }
|
||||
>this : this
|
||||
>props : ComponentProps & { children?: React.ReactNode; }
|
||||
>props : ComponentProps & { children?: {}; }
|
||||
|
||||
return (<AnyComponent />);
|
||||
>(<AnyComponent />) : JSX.Element
|
||||
|
|
|
@ -16,9 +16,8 @@ tests/cases/compiler/tupleTypes.ts(47,1): error TS2322: Type '[number, string]'
|
|||
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[]'.
|
||||
Types of property 'pop' are incompatible.
|
||||
Type '() => number | {}' 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'.
|
||||
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]'.
|
||||
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]'.
|
||||
|
@ -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: Types of property 'pop' are incompatible.
|
||||
!!! error TS2322: Type '() => number | {}' 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'.
|
||||
!!! error TS2322: Type '{}' is not assignable to type 'number'.
|
||||
a1 = a2; // Error
|
||||
~~
|
||||
!!! error TS2322: Type '[number, number]' is not assignable to type '[number, string]'.
|
||||
|
|
|
@ -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) {}) : Promise<{}>
|
||||
>Promise : PromiseConstructor
|
||||
>function(resolve, reject) {} : (resolve: (value?: {} | PromiseLike<{}>) => void, reject: (reason?: any) => void) => void
|
||||
>resolve : (value?: {} | PromiseLike<{}>) => void
|
||||
>function(resolve, reject) {} : (resolve: (value?: {}) => void, reject: (reason?: any) => void) => void
|
||||
>resolve : (value?: {}) => void
|
||||
>reject : (reason?: any) => void
|
||||
|
||||
.finally(function() {});
|
||||
|
|
|
@ -9,7 +9,7 @@ const [r0, r1, r2, r3] = test.ranges();
|
|||
const i = { definition: "(property) I.x: {}", ranges: [r0] };
|
||||
const j = { definition: "(property) J.x: {}", ranges: [r1] };
|
||||
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(r1, [j, intersect]);
|
||||
verify.referenceGroups(r2, [anon, intersect]);
|
||||
|
|
Loading…
Reference in a new issue