mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Rename strictOptionalProperties -> exactOptionalPropertyTypes and remove from strict family (#44626)
This commit is contained in:
@@ -343,12 +343,12 @@ namespace ts {
|
||||
const strictFunctionTypes = getStrictOptionValue(compilerOptions, "strictFunctionTypes");
|
||||
const strictBindCallApply = getStrictOptionValue(compilerOptions, "strictBindCallApply");
|
||||
const strictPropertyInitialization = getStrictOptionValue(compilerOptions, "strictPropertyInitialization");
|
||||
const strictOptionalProperties = getStrictOptionValue(compilerOptions, "strictOptionalProperties");
|
||||
const noImplicitAny = getStrictOptionValue(compilerOptions, "noImplicitAny");
|
||||
const noImplicitThis = getStrictOptionValue(compilerOptions, "noImplicitThis");
|
||||
const useUnknownInCatchVariables = getStrictOptionValue(compilerOptions, "useUnknownInCatchVariables");
|
||||
const keyofStringsOnly = !!compilerOptions.keyofStringsOnly;
|
||||
const freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : ObjectFlags.FreshLiteral;
|
||||
const exactOptionalPropertyTypes = compilerOptions.exactOptionalPropertyTypes;
|
||||
|
||||
const checkBinaryExpression = createCheckBinaryExpression();
|
||||
const emitResolver = createResolver();
|
||||
@@ -740,7 +740,7 @@ namespace ts {
|
||||
const undefinedType = createIntrinsicType(TypeFlags.Undefined, "undefined");
|
||||
const undefinedWideningType = strictNullChecks ? undefinedType : createIntrinsicType(TypeFlags.Undefined, "undefined", ObjectFlags.ContainsWideningType);
|
||||
const optionalType = createIntrinsicType(TypeFlags.Undefined, "undefined");
|
||||
const missingType = strictOptionalProperties ? createIntrinsicType(TypeFlags.Undefined, "undefined") : undefinedType;
|
||||
const missingType = exactOptionalPropertyTypes ? createIntrinsicType(TypeFlags.Undefined, "undefined") : undefinedType;
|
||||
const nullType = createIntrinsicType(TypeFlags.Null, "null");
|
||||
const nullWideningType = strictNullChecks ? nullType : createIntrinsicType(TypeFlags.Null, "null", ObjectFlags.ContainsWideningType);
|
||||
const stringType = createIntrinsicType(TypeFlags.String, "string");
|
||||
@@ -13886,7 +13886,7 @@ namespace ts {
|
||||
if (includes & TypeFlags.AnyOrUnknown) {
|
||||
return includes & TypeFlags.Any ? includes & TypeFlags.IncludesWildcard ? wildcardType : anyType : unknownType;
|
||||
}
|
||||
if (strictOptionalProperties && includes & TypeFlags.Undefined) {
|
||||
if (exactOptionalPropertyTypes && includes & TypeFlags.Undefined) {
|
||||
const missingIndex = binarySearch(typeSet, missingType, getTypeId, compareValues);
|
||||
if (missingIndex >= 0 && containsType(typeSet, undefinedType)) {
|
||||
orderedRemoveItemAt(typeSet, missingIndex);
|
||||
@@ -20358,15 +20358,15 @@ namespace ts {
|
||||
}
|
||||
|
||||
function removeMissingType(type: Type, isOptional: boolean) {
|
||||
return strictOptionalProperties && isOptional ? removeType(type, missingType) : type;
|
||||
return exactOptionalPropertyTypes && isOptional ? removeType(type, missingType) : type;
|
||||
}
|
||||
|
||||
function containsMissingType(type: Type) {
|
||||
return strictOptionalProperties && (type === missingType || type.flags & TypeFlags.Union && containsType((type as UnionType).types, missingType));
|
||||
return exactOptionalPropertyTypes && (type === missingType || type.flags & TypeFlags.Union && containsType((type as UnionType).types, missingType));
|
||||
}
|
||||
|
||||
function removeMissingOrUndefinedType(type: Type): Type {
|
||||
return strictOptionalProperties ? removeType(type, missingType) : getTypeWithFacts(type, TypeFacts.NEUndefined);
|
||||
return exactOptionalPropertyTypes ? removeType(type, missingType) : getTypeWithFacts(type, TypeFacts.NEUndefined);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -21752,7 +21752,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
function isTypeOrBaseIdenticalTo(s: Type, t: Type) {
|
||||
return strictOptionalProperties && t === missingType ? s === t :
|
||||
return exactOptionalPropertyTypes && t === missingType ? s === t :
|
||||
(isTypeIdenticalTo(s, t) || !!(t.flags & TypeFlags.String && s.flags & TypeFlags.StringLiteral || t.flags & TypeFlags.Number && s.flags & TypeFlags.NumberLiteral));
|
||||
}
|
||||
|
||||
@@ -26084,7 +26084,7 @@ namespace ts {
|
||||
elementFlags.push(ElementFlags.Rest);
|
||||
}
|
||||
}
|
||||
else if (strictOptionalProperties && e.kind === SyntaxKind.OmittedExpression) {
|
||||
else if (exactOptionalPropertyTypes && e.kind === SyntaxKind.OmittedExpression) {
|
||||
hasOmittedExpression = true;
|
||||
elementTypes.push(missingType);
|
||||
elementFlags.push(ElementFlags.Optional);
|
||||
|
||||
@@ -648,14 +648,6 @@ namespace ts {
|
||||
description: Diagnostics.Check_for_class_properties_that_are_declared_but_not_set_in_the_constructor,
|
||||
defaultValueDescription: Diagnostics.false_unless_strict_is_set
|
||||
},
|
||||
{
|
||||
name: "strictOptionalProperties",
|
||||
type: "boolean",
|
||||
affectsSemanticDiagnostics: true,
|
||||
strictFlag: true,
|
||||
category: Diagnostics.Type_Checking,
|
||||
description: Diagnostics.Enable_strict_checking_of_optional_properties
|
||||
},
|
||||
{
|
||||
name: "noImplicitThis",
|
||||
type: "boolean",
|
||||
@@ -700,6 +692,13 @@ namespace ts {
|
||||
description: Diagnostics.Raise_an_error_when_a_function_parameter_isn_t_read,
|
||||
defaultValueDescription: "false"
|
||||
},
|
||||
{
|
||||
name: "exactOptionalPropertyTypes",
|
||||
type: "boolean",
|
||||
affectsSemanticDiagnostics: true,
|
||||
category: Diagnostics.Type_Checking,
|
||||
description: Diagnostics.Interpret_optional_property_types_as_written_rather_than_adding_undefined
|
||||
},
|
||||
{
|
||||
name: "noImplicitReturns",
|
||||
type: "boolean",
|
||||
|
||||
@@ -4853,7 +4853,7 @@
|
||||
"category": "Message",
|
||||
"code": 6242
|
||||
},
|
||||
"Enable strict checking of optional properties.": {
|
||||
"Interpret optional property types as written, rather than adding 'undefined'.": {
|
||||
"category": "Message",
|
||||
"code": 6243
|
||||
},
|
||||
|
||||
@@ -3043,8 +3043,8 @@ namespace ts {
|
||||
if (options.strictPropertyInitialization && !getStrictOptionValue(options, "strictNullChecks")) {
|
||||
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "strictPropertyInitialization", "strictNullChecks");
|
||||
}
|
||||
if (options.strictOptionalProperties && !getStrictOptionValue(options, "strictNullChecks")) {
|
||||
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "strictOptionalProperties", "strictNullChecks");
|
||||
if (options.exactOptionalPropertyTypes && !getStrictOptionValue(options, "strictNullChecks")) {
|
||||
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "exactOptionalPropertyTypes", "strictNullChecks");
|
||||
}
|
||||
|
||||
if (options.isolatedModules) {
|
||||
|
||||
@@ -5972,6 +5972,7 @@ namespace ts {
|
||||
downlevelIteration?: boolean;
|
||||
emitBOM?: boolean;
|
||||
emitDecoratorMetadata?: boolean;
|
||||
exactOptionalPropertyTypes?: boolean;
|
||||
experimentalDecorators?: boolean;
|
||||
forceConsistentCasingInFileNames?: boolean;
|
||||
/*@internal*/generateCpuProfile?: string;
|
||||
@@ -6046,7 +6047,6 @@ namespace ts {
|
||||
strictBindCallApply?: boolean; // Always combine with strict property
|
||||
strictNullChecks?: boolean; // Always combine with strict property
|
||||
strictPropertyInitialization?: boolean; // Always combine with strict property
|
||||
strictOptionalProperties?: boolean; // Always combine with strict property
|
||||
stripInternal?: boolean;
|
||||
suppressExcessPropertyErrors?: boolean;
|
||||
suppressImplicitAnyIndexErrors?: boolean;
|
||||
|
||||
@@ -6098,7 +6098,6 @@ namespace ts {
|
||||
| "strictFunctionTypes"
|
||||
| "strictBindCallApply"
|
||||
| "strictPropertyInitialization"
|
||||
| "strictOptionalProperties"
|
||||
| "alwaysStrict"
|
||||
| "useUnknownInCatchVariables"
|
||||
;
|
||||
|
||||
+1
-1
@@ -2853,6 +2853,7 @@ declare namespace ts {
|
||||
downlevelIteration?: boolean;
|
||||
emitBOM?: boolean;
|
||||
emitDecoratorMetadata?: boolean;
|
||||
exactOptionalPropertyTypes?: boolean;
|
||||
experimentalDecorators?: boolean;
|
||||
forceConsistentCasingInFileNames?: boolean;
|
||||
importHelpers?: boolean;
|
||||
@@ -2913,7 +2914,6 @@ declare namespace ts {
|
||||
strictBindCallApply?: boolean;
|
||||
strictNullChecks?: boolean;
|
||||
strictPropertyInitialization?: boolean;
|
||||
strictOptionalProperties?: boolean;
|
||||
stripInternal?: boolean;
|
||||
suppressExcessPropertyErrors?: boolean;
|
||||
suppressImplicitAnyIndexErrors?: boolean;
|
||||
|
||||
+1
-1
@@ -2853,6 +2853,7 @@ declare namespace ts {
|
||||
downlevelIteration?: boolean;
|
||||
emitBOM?: boolean;
|
||||
emitDecoratorMetadata?: boolean;
|
||||
exactOptionalPropertyTypes?: boolean;
|
||||
experimentalDecorators?: boolean;
|
||||
forceConsistentCasingInFileNames?: boolean;
|
||||
importHelpers?: boolean;
|
||||
@@ -2913,7 +2914,6 @@ declare namespace ts {
|
||||
strictBindCallApply?: boolean;
|
||||
strictNullChecks?: boolean;
|
||||
strictPropertyInitialization?: boolean;
|
||||
strictOptionalProperties?: boolean;
|
||||
stripInternal?: boolean;
|
||||
suppressExcessPropertyErrors?: boolean;
|
||||
suppressImplicitAnyIndexErrors?: boolean;
|
||||
|
||||
@@ -16,7 +16,7 @@ declare class Component<P> {
|
||||
|
||||
class C<T> extends Component<{ x?: boolean; } & T> {}
|
||||
>C : C<T>
|
||||
>Component : Component<{ x?: boolean; } & T>
|
||||
>Component : Component<{ x?: boolean | undefined; } & T>
|
||||
>x : boolean | undefined
|
||||
|
||||
const y = new C({foobar: "example"});
|
||||
|
||||
+2
-2
@@ -10,7 +10,7 @@ declare class Component<P> {
|
||||
>context : any
|
||||
|
||||
readonly props: Readonly<P> & Readonly<{ children?: {} }>;
|
||||
>props : Readonly<P> & Readonly<{ children?: {}; }>
|
||||
>props : Readonly<P> & Readonly<{ children?: {} | undefined; }>
|
||||
>children : {} | undefined
|
||||
}
|
||||
interface ComponentClass<P = {}> {
|
||||
@@ -29,7 +29,7 @@ interface ComponentClass<P = {}> {
|
||||
}
|
||||
interface FunctionComponent<P = {}> {
|
||||
(props: P & { children?: {} }, context?: any): {} | null;
|
||||
>props : P & { children?: {}; }
|
||||
>props : P & { children?: {} | undefined; }
|
||||
>children : {} | undefined
|
||||
>context : any
|
||||
>null : null
|
||||
|
||||
@@ -16,7 +16,7 @@ declare function id3<T extends (x: { foo: any }) => any>(input: T): T;
|
||||
|
||||
declare function id4<T extends (x: { foo?: number }) => any>(input: T): T;
|
||||
>id4 : <T extends (x: { foo?: number;}) => any>(input: T) => T
|
||||
>x : { foo?: number; }
|
||||
>x : { foo?: number | undefined; }
|
||||
>foo : number | undefined
|
||||
>input : T
|
||||
|
||||
@@ -60,10 +60,10 @@ const f13 = id3(function ({ foo = 42 }) { return foo });
|
||||
>foo : any
|
||||
|
||||
const f14 = id4(function ({ foo = 42 }) { return foo });
|
||||
>f14 : ({ foo }: { foo?: number; }) => number
|
||||
>id4(function ({ foo = 42 }) { return foo }) : ({ foo }: { foo?: number; }) => number
|
||||
>id4 : <T extends (x: { foo?: number; }) => any>(input: T) => T
|
||||
>function ({ foo = 42 }) { return foo } : ({ foo }: { foo?: number; }) => number
|
||||
>f14 : ({ foo }: { foo?: number | undefined; }) => number
|
||||
>id4(function ({ foo = 42 }) { return foo }) : ({ foo }: { foo?: number | undefined; }) => number
|
||||
>id4 : <T extends (x: { foo?: number | undefined; }) => any>(input: T) => T
|
||||
>function ({ foo = 42 }) { return foo } : ({ foo }: { foo?: number | undefined; }) => number
|
||||
>foo : number
|
||||
>42 : 42
|
||||
>foo : number
|
||||
|
||||
@@ -249,256 +249,256 @@ o3.x;
|
||||
>x : 1 | 2
|
||||
|
||||
declare const o4: { x?: { y: boolean } };
|
||||
>o4 : { x?: { y: boolean;}; }
|
||||
>o4 : { x?: { y: boolean; } | undefined; }
|
||||
>x : { y: boolean; } | undefined
|
||||
>y : boolean
|
||||
|
||||
if (o4.x?.y) {
|
||||
>o4.x?.y : boolean | undefined
|
||||
>o4.x : { y: boolean; } | undefined
|
||||
>o4 : { x?: { y: boolean; }; }
|
||||
>o4 : { x?: { y: boolean; } | undefined; }
|
||||
>x : { y: boolean; } | undefined
|
||||
>y : boolean | undefined
|
||||
|
||||
o4.x; // { y: boolean }
|
||||
>o4.x : { y: boolean; }
|
||||
>o4 : { x?: { y: boolean; }; }
|
||||
>o4 : { x?: { y: boolean; } | undefined; }
|
||||
>x : { y: boolean; }
|
||||
|
||||
o4.x.y; // true
|
||||
>o4.x.y : true
|
||||
>o4.x : { y: boolean; }
|
||||
>o4 : { x?: { y: boolean; }; }
|
||||
>o4 : { x?: { y: boolean; } | undefined; }
|
||||
>x : { y: boolean; }
|
||||
>y : true
|
||||
|
||||
o4.x?.y; // true
|
||||
>o4.x?.y : true
|
||||
>o4.x : { y: boolean; }
|
||||
>o4 : { x?: { y: boolean; }; }
|
||||
>o4 : { x?: { y: boolean; } | undefined; }
|
||||
>x : { y: boolean; }
|
||||
>y : true
|
||||
}
|
||||
else {
|
||||
o4.x;
|
||||
>o4.x : { y: boolean; } | undefined
|
||||
>o4 : { x?: { y: boolean; }; }
|
||||
>o4 : { x?: { y: boolean; } | undefined; }
|
||||
>x : { y: boolean; } | undefined
|
||||
|
||||
o4.x?.y;
|
||||
>o4.x?.y : boolean | undefined
|
||||
>o4.x : { y: boolean; } | undefined
|
||||
>o4 : { x?: { y: boolean; }; }
|
||||
>o4 : { x?: { y: boolean; } | undefined; }
|
||||
>x : { y: boolean; } | undefined
|
||||
>y : boolean | undefined
|
||||
|
||||
o4.x.y;
|
||||
>o4.x.y : boolean
|
||||
>o4.x : { y: boolean; } | undefined
|
||||
>o4 : { x?: { y: boolean; }; }
|
||||
>o4 : { x?: { y: boolean; } | undefined; }
|
||||
>x : { y: boolean; } | undefined
|
||||
>y : boolean
|
||||
}
|
||||
o4.x;
|
||||
>o4.x : { y: boolean; } | undefined
|
||||
>o4 : { x?: { y: boolean; }; }
|
||||
>o4 : { x?: { y: boolean; } | undefined; }
|
||||
>x : { y: boolean; } | undefined
|
||||
|
||||
o4.x?.y;
|
||||
>o4.x?.y : boolean | undefined
|
||||
>o4.x : { y: boolean; } | undefined
|
||||
>o4 : { x?: { y: boolean; }; }
|
||||
>o4 : { x?: { y: boolean; } | undefined; }
|
||||
>x : { y: boolean; } | undefined
|
||||
>y : boolean | undefined
|
||||
|
||||
o4.x.y;
|
||||
>o4.x.y : boolean
|
||||
>o4.x : { y: boolean; } | undefined
|
||||
>o4 : { x?: { y: boolean; }; }
|
||||
>o4 : { x?: { y: boolean; } | undefined; }
|
||||
>x : { y: boolean; } | undefined
|
||||
>y : boolean
|
||||
|
||||
declare const o5: { x?: { y: { z?: { w: boolean } } } };
|
||||
>o5 : { x?: { y: { z?: { w: boolean; }; };}; }
|
||||
>o5 : { x?: { y: { z?: { w: boolean; };}; } | undefined; }
|
||||
>x : { y: { z?: { w: boolean; };}; } | undefined
|
||||
>y : { z?: { w: boolean;}; }
|
||||
>y : { z?: { w: boolean; } | undefined; }
|
||||
>z : { w: boolean; } | undefined
|
||||
>w : boolean
|
||||
|
||||
if (o5.x?.y.z?.w) {
|
||||
>o5.x?.y.z?.w : boolean | undefined
|
||||
>o5.x?.y.z : { w: boolean; } | undefined
|
||||
>o5.x?.y : { z?: { w: boolean; }; } | undefined
|
||||
>o5.x : { y: { z?: { w: boolean; }; }; } | undefined
|
||||
>o5 : { x?: { y: { z?: { w: boolean; }; }; }; }
|
||||
>x : { y: { z?: { w: boolean; }; }; } | undefined
|
||||
>y : { z?: { w: boolean; }; } | undefined
|
||||
>o5.x?.y : { z?: { w: boolean; } | undefined; } | undefined
|
||||
>o5.x : { y: { z?: { w: boolean; } | undefined; }; } | undefined
|
||||
>o5 : { x?: { y: { z?: { w: boolean; } | undefined; }; } | undefined; }
|
||||
>x : { y: { z?: { w: boolean; } | undefined; }; } | undefined
|
||||
>y : { z?: { w: boolean; } | undefined; } | undefined
|
||||
>z : { w: boolean; } | undefined
|
||||
>w : boolean | undefined
|
||||
|
||||
o5.x;
|
||||
>o5.x : { y: { z?: { w: boolean; }; }; }
|
||||
>o5 : { x?: { y: { z?: { w: boolean; }; }; }; }
|
||||
>x : { y: { z?: { w: boolean; }; }; }
|
||||
>o5.x : { y: { z?: { w: boolean; } | undefined; }; }
|
||||
>o5 : { x?: { y: { z?: { w: boolean; } | undefined; }; } | undefined; }
|
||||
>x : { y: { z?: { w: boolean; } | undefined; }; }
|
||||
|
||||
o5.x.y;
|
||||
>o5.x.y : { z?: { w: boolean; }; }
|
||||
>o5.x : { y: { z?: { w: boolean; }; }; }
|
||||
>o5 : { x?: { y: { z?: { w: boolean; }; }; }; }
|
||||
>x : { y: { z?: { w: boolean; }; }; }
|
||||
>y : { z?: { w: boolean; }; }
|
||||
>o5.x.y : { z?: { w: boolean; } | undefined; }
|
||||
>o5.x : { y: { z?: { w: boolean; } | undefined; }; }
|
||||
>o5 : { x?: { y: { z?: { w: boolean; } | undefined; }; } | undefined; }
|
||||
>x : { y: { z?: { w: boolean; } | undefined; }; }
|
||||
>y : { z?: { w: boolean; } | undefined; }
|
||||
|
||||
o5.x.y.z;
|
||||
>o5.x.y.z : { w: boolean; }
|
||||
>o5.x.y : { z?: { w: boolean; }; }
|
||||
>o5.x : { y: { z?: { w: boolean; }; }; }
|
||||
>o5 : { x?: { y: { z?: { w: boolean; }; }; }; }
|
||||
>x : { y: { z?: { w: boolean; }; }; }
|
||||
>y : { z?: { w: boolean; }; }
|
||||
>o5.x.y : { z?: { w: boolean; } | undefined; }
|
||||
>o5.x : { y: { z?: { w: boolean; } | undefined; }; }
|
||||
>o5 : { x?: { y: { z?: { w: boolean; } | undefined; }; } | undefined; }
|
||||
>x : { y: { z?: { w: boolean; } | undefined; }; }
|
||||
>y : { z?: { w: boolean; } | undefined; }
|
||||
>z : { w: boolean; }
|
||||
|
||||
o5.x.y.z.w; // true
|
||||
>o5.x.y.z.w : true
|
||||
>o5.x.y.z : { w: boolean; }
|
||||
>o5.x.y : { z?: { w: boolean; }; }
|
||||
>o5.x : { y: { z?: { w: boolean; }; }; }
|
||||
>o5 : { x?: { y: { z?: { w: boolean; }; }; }; }
|
||||
>x : { y: { z?: { w: boolean; }; }; }
|
||||
>y : { z?: { w: boolean; }; }
|
||||
>o5.x.y : { z?: { w: boolean; } | undefined; }
|
||||
>o5.x : { y: { z?: { w: boolean; } | undefined; }; }
|
||||
>o5 : { x?: { y: { z?: { w: boolean; } | undefined; }; } | undefined; }
|
||||
>x : { y: { z?: { w: boolean; } | undefined; }; }
|
||||
>y : { z?: { w: boolean; } | undefined; }
|
||||
>z : { w: boolean; }
|
||||
>w : true
|
||||
|
||||
o5.x.y.z?.w; // true
|
||||
>o5.x.y.z?.w : true
|
||||
>o5.x.y.z : { w: boolean; }
|
||||
>o5.x.y : { z?: { w: boolean; }; }
|
||||
>o5.x : { y: { z?: { w: boolean; }; }; }
|
||||
>o5 : { x?: { y: { z?: { w: boolean; }; }; }; }
|
||||
>x : { y: { z?: { w: boolean; }; }; }
|
||||
>y : { z?: { w: boolean; }; }
|
||||
>o5.x.y : { z?: { w: boolean; } | undefined; }
|
||||
>o5.x : { y: { z?: { w: boolean; } | undefined; }; }
|
||||
>o5 : { x?: { y: { z?: { w: boolean; } | undefined; }; } | undefined; }
|
||||
>x : { y: { z?: { w: boolean; } | undefined; }; }
|
||||
>y : { z?: { w: boolean; } | undefined; }
|
||||
>z : { w: boolean; }
|
||||
>w : true
|
||||
|
||||
o5.x?.y.z.w; // true
|
||||
>o5.x?.y.z.w : true
|
||||
>o5.x?.y.z : { w: boolean; }
|
||||
>o5.x?.y : { z?: { w: boolean; }; }
|
||||
>o5.x : { y: { z?: { w: boolean; }; }; }
|
||||
>o5 : { x?: { y: { z?: { w: boolean; }; }; }; }
|
||||
>x : { y: { z?: { w: boolean; }; }; }
|
||||
>y : { z?: { w: boolean; }; }
|
||||
>o5.x?.y : { z?: { w: boolean; } | undefined; }
|
||||
>o5.x : { y: { z?: { w: boolean; } | undefined; }; }
|
||||
>o5 : { x?: { y: { z?: { w: boolean; } | undefined; }; } | undefined; }
|
||||
>x : { y: { z?: { w: boolean; } | undefined; }; }
|
||||
>y : { z?: { w: boolean; } | undefined; }
|
||||
>z : { w: boolean; }
|
||||
>w : true
|
||||
|
||||
o5.x?.y.z?.w; // true
|
||||
>o5.x?.y.z?.w : true
|
||||
>o5.x?.y.z : { w: boolean; }
|
||||
>o5.x?.y : { z?: { w: boolean; }; }
|
||||
>o5.x : { y: { z?: { w: boolean; }; }; }
|
||||
>o5 : { x?: { y: { z?: { w: boolean; }; }; }; }
|
||||
>x : { y: { z?: { w: boolean; }; }; }
|
||||
>y : { z?: { w: boolean; }; }
|
||||
>o5.x?.y : { z?: { w: boolean; } | undefined; }
|
||||
>o5.x : { y: { z?: { w: boolean; } | undefined; }; }
|
||||
>o5 : { x?: { y: { z?: { w: boolean; } | undefined; }; } | undefined; }
|
||||
>x : { y: { z?: { w: boolean; } | undefined; }; }
|
||||
>y : { z?: { w: boolean; } | undefined; }
|
||||
>z : { w: boolean; }
|
||||
>w : true
|
||||
}
|
||||
else {
|
||||
o5.x;
|
||||
>o5.x : { y: { z?: { w: boolean; }; }; } | undefined
|
||||
>o5 : { x?: { y: { z?: { w: boolean; }; }; }; }
|
||||
>x : { y: { z?: { w: boolean; }; }; } | undefined
|
||||
>o5.x : { y: { z?: { w: boolean; } | undefined; }; } | undefined
|
||||
>o5 : { x?: { y: { z?: { w: boolean; } | undefined; }; } | undefined; }
|
||||
>x : { y: { z?: { w: boolean; } | undefined; }; } | undefined
|
||||
|
||||
o5.x?.y;
|
||||
>o5.x?.y : { z?: { w: boolean; }; } | undefined
|
||||
>o5.x : { y: { z?: { w: boolean; }; }; } | undefined
|
||||
>o5 : { x?: { y: { z?: { w: boolean; }; }; }; }
|
||||
>x : { y: { z?: { w: boolean; }; }; } | undefined
|
||||
>y : { z?: { w: boolean; }; } | undefined
|
||||
>o5.x?.y : { z?: { w: boolean; } | undefined; } | undefined
|
||||
>o5.x : { y: { z?: { w: boolean; } | undefined; }; } | undefined
|
||||
>o5 : { x?: { y: { z?: { w: boolean; } | undefined; }; } | undefined; }
|
||||
>x : { y: { z?: { w: boolean; } | undefined; }; } | undefined
|
||||
>y : { z?: { w: boolean; } | undefined; } | undefined
|
||||
|
||||
o5.x?.y.z;
|
||||
>o5.x?.y.z : { w: boolean; } | undefined
|
||||
>o5.x?.y : { z?: { w: boolean; }; } | undefined
|
||||
>o5.x : { y: { z?: { w: boolean; }; }; } | undefined
|
||||
>o5 : { x?: { y: { z?: { w: boolean; }; }; }; }
|
||||
>x : { y: { z?: { w: boolean; }; }; } | undefined
|
||||
>y : { z?: { w: boolean; }; } | undefined
|
||||
>o5.x?.y : { z?: { w: boolean; } | undefined; } | undefined
|
||||
>o5.x : { y: { z?: { w: boolean; } | undefined; }; } | undefined
|
||||
>o5 : { x?: { y: { z?: { w: boolean; } | undefined; }; } | undefined; }
|
||||
>x : { y: { z?: { w: boolean; } | undefined; }; } | undefined
|
||||
>y : { z?: { w: boolean; } | undefined; } | undefined
|
||||
>z : { w: boolean; } | undefined
|
||||
|
||||
o5.x?.y.z?.w;
|
||||
>o5.x?.y.z?.w : boolean | undefined
|
||||
>o5.x?.y.z : { w: boolean; } | undefined
|
||||
>o5.x?.y : { z?: { w: boolean; }; } | undefined
|
||||
>o5.x : { y: { z?: { w: boolean; }; }; } | undefined
|
||||
>o5 : { x?: { y: { z?: { w: boolean; }; }; }; }
|
||||
>x : { y: { z?: { w: boolean; }; }; } | undefined
|
||||
>y : { z?: { w: boolean; }; } | undefined
|
||||
>o5.x?.y : { z?: { w: boolean; } | undefined; } | undefined
|
||||
>o5.x : { y: { z?: { w: boolean; } | undefined; }; } | undefined
|
||||
>o5 : { x?: { y: { z?: { w: boolean; } | undefined; }; } | undefined; }
|
||||
>x : { y: { z?: { w: boolean; } | undefined; }; } | undefined
|
||||
>y : { z?: { w: boolean; } | undefined; } | undefined
|
||||
>z : { w: boolean; } | undefined
|
||||
>w : boolean | undefined
|
||||
|
||||
o5.x.y;
|
||||
>o5.x.y : { z?: { w: boolean; }; }
|
||||
>o5.x : { y: { z?: { w: boolean; }; }; } | undefined
|
||||
>o5 : { x?: { y: { z?: { w: boolean; }; }; }; }
|
||||
>x : { y: { z?: { w: boolean; }; }; } | undefined
|
||||
>y : { z?: { w: boolean; }; }
|
||||
>o5.x.y : { z?: { w: boolean; } | undefined; }
|
||||
>o5.x : { y: { z?: { w: boolean; } | undefined; }; } | undefined
|
||||
>o5 : { x?: { y: { z?: { w: boolean; } | undefined; }; } | undefined; }
|
||||
>x : { y: { z?: { w: boolean; } | undefined; }; } | undefined
|
||||
>y : { z?: { w: boolean; } | undefined; }
|
||||
|
||||
o5.x.y.z.w;
|
||||
>o5.x.y.z.w : boolean
|
||||
>o5.x.y.z : { w: boolean; } | undefined
|
||||
>o5.x.y : { z?: { w: boolean; }; }
|
||||
>o5.x : { y: { z?: { w: boolean; }; }; } | undefined
|
||||
>o5 : { x?: { y: { z?: { w: boolean; }; }; }; }
|
||||
>x : { y: { z?: { w: boolean; }; }; } | undefined
|
||||
>y : { z?: { w: boolean; }; }
|
||||
>o5.x.y : { z?: { w: boolean; } | undefined; }
|
||||
>o5.x : { y: { z?: { w: boolean; } | undefined; }; } | undefined
|
||||
>o5 : { x?: { y: { z?: { w: boolean; } | undefined; }; } | undefined; }
|
||||
>x : { y: { z?: { w: boolean; } | undefined; }; } | undefined
|
||||
>y : { z?: { w: boolean; } | undefined; }
|
||||
>z : { w: boolean; } | undefined
|
||||
>w : boolean
|
||||
}
|
||||
o5.x;
|
||||
>o5.x : { y: { z?: { w: boolean; }; }; } | undefined
|
||||
>o5 : { x?: { y: { z?: { w: boolean; }; }; }; }
|
||||
>x : { y: { z?: { w: boolean; }; }; } | undefined
|
||||
>o5.x : { y: { z?: { w: boolean; } | undefined; }; } | undefined
|
||||
>o5 : { x?: { y: { z?: { w: boolean; } | undefined; }; } | undefined; }
|
||||
>x : { y: { z?: { w: boolean; } | undefined; }; } | undefined
|
||||
|
||||
o5.x?.y;
|
||||
>o5.x?.y : { z?: { w: boolean; }; } | undefined
|
||||
>o5.x : { y: { z?: { w: boolean; }; }; } | undefined
|
||||
>o5 : { x?: { y: { z?: { w: boolean; }; }; }; }
|
||||
>x : { y: { z?: { w: boolean; }; }; } | undefined
|
||||
>y : { z?: { w: boolean; }; } | undefined
|
||||
>o5.x?.y : { z?: { w: boolean; } | undefined; } | undefined
|
||||
>o5.x : { y: { z?: { w: boolean; } | undefined; }; } | undefined
|
||||
>o5 : { x?: { y: { z?: { w: boolean; } | undefined; }; } | undefined; }
|
||||
>x : { y: { z?: { w: boolean; } | undefined; }; } | undefined
|
||||
>y : { z?: { w: boolean; } | undefined; } | undefined
|
||||
|
||||
o5.x?.y.z;
|
||||
>o5.x?.y.z : { w: boolean; } | undefined
|
||||
>o5.x?.y : { z?: { w: boolean; }; } | undefined
|
||||
>o5.x : { y: { z?: { w: boolean; }; }; } | undefined
|
||||
>o5 : { x?: { y: { z?: { w: boolean; }; }; }; }
|
||||
>x : { y: { z?: { w: boolean; }; }; } | undefined
|
||||
>y : { z?: { w: boolean; }; } | undefined
|
||||
>o5.x?.y : { z?: { w: boolean; } | undefined; } | undefined
|
||||
>o5.x : { y: { z?: { w: boolean; } | undefined; }; } | undefined
|
||||
>o5 : { x?: { y: { z?: { w: boolean; } | undefined; }; } | undefined; }
|
||||
>x : { y: { z?: { w: boolean; } | undefined; }; } | undefined
|
||||
>y : { z?: { w: boolean; } | undefined; } | undefined
|
||||
>z : { w: boolean; } | undefined
|
||||
|
||||
o5.x?.y.z?.w;
|
||||
>o5.x?.y.z?.w : boolean | undefined
|
||||
>o5.x?.y.z : { w: boolean; } | undefined
|
||||
>o5.x?.y : { z?: { w: boolean; }; } | undefined
|
||||
>o5.x : { y: { z?: { w: boolean; }; }; } | undefined
|
||||
>o5 : { x?: { y: { z?: { w: boolean; }; }; }; }
|
||||
>x : { y: { z?: { w: boolean; }; }; } | undefined
|
||||
>y : { z?: { w: boolean; }; } | undefined
|
||||
>o5.x?.y : { z?: { w: boolean; } | undefined; } | undefined
|
||||
>o5.x : { y: { z?: { w: boolean; } | undefined; }; } | undefined
|
||||
>o5 : { x?: { y: { z?: { w: boolean; } | undefined; }; } | undefined; }
|
||||
>x : { y: { z?: { w: boolean; } | undefined; }; } | undefined
|
||||
>y : { z?: { w: boolean; } | undefined; } | undefined
|
||||
>z : { w: boolean; } | undefined
|
||||
>w : boolean | undefined
|
||||
|
||||
o5.x.y;
|
||||
>o5.x.y : { z?: { w: boolean; }; }
|
||||
>o5.x : { y: { z?: { w: boolean; }; }; } | undefined
|
||||
>o5 : { x?: { y: { z?: { w: boolean; }; }; }; }
|
||||
>x : { y: { z?: { w: boolean; }; }; } | undefined
|
||||
>y : { z?: { w: boolean; }; }
|
||||
>o5.x.y : { z?: { w: boolean; } | undefined; }
|
||||
>o5.x : { y: { z?: { w: boolean; } | undefined; }; } | undefined
|
||||
>o5 : { x?: { y: { z?: { w: boolean; } | undefined; }; } | undefined; }
|
||||
>x : { y: { z?: { w: boolean; } | undefined; }; } | undefined
|
||||
>y : { z?: { w: boolean; } | undefined; }
|
||||
|
||||
o5.x.y.z.w;
|
||||
>o5.x.y.z.w : boolean
|
||||
>o5.x.y.z : { w: boolean; } | undefined
|
||||
>o5.x.y : { z?: { w: boolean; }; }
|
||||
>o5.x : { y: { z?: { w: boolean; }; }; } | undefined
|
||||
>o5 : { x?: { y: { z?: { w: boolean; }; }; }; }
|
||||
>x : { y: { z?: { w: boolean; }; }; } | undefined
|
||||
>y : { z?: { w: boolean; }; }
|
||||
>o5.x.y : { z?: { w: boolean; } | undefined; }
|
||||
>o5.x : { y: { z?: { w: boolean; } | undefined; }; } | undefined
|
||||
>o5 : { x?: { y: { z?: { w: boolean; } | undefined; }; } | undefined; }
|
||||
>x : { y: { z?: { w: boolean; } | undefined; }; } | undefined
|
||||
>y : { z?: { w: boolean; } | undefined; }
|
||||
>z : { w: boolean; } | undefined
|
||||
>w : boolean
|
||||
|
||||
|
||||
@@ -61,9 +61,9 @@ delete (o3.b?.c);
|
||||
>c : string | undefined
|
||||
|
||||
declare const o4: { b?: { c: { d?: { e: string } } } };
|
||||
>o4 : { b?: { c: { d?: { e: string; }; };}; }
|
||||
>o4 : { b?: { c: { d?: { e: string; };}; } | undefined; }
|
||||
>b : { c: { d?: { e: string; };}; } | undefined
|
||||
>c : { d?: { e: string;}; }
|
||||
>c : { d?: { e: string; } | undefined; }
|
||||
>d : { e: string; } | undefined
|
||||
>e : string
|
||||
|
||||
@@ -71,11 +71,11 @@ delete o4.b?.c.d?.e;
|
||||
>delete o4.b?.c.d?.e : boolean
|
||||
>o4.b?.c.d?.e : string | undefined
|
||||
>o4.b?.c.d : { e: string; } | undefined
|
||||
>o4.b?.c : { d?: { e: string; }; } | undefined
|
||||
>o4.b : { c: { d?: { e: string; }; }; } | undefined
|
||||
>o4 : { b?: { c: { d?: { e: string; }; }; }; }
|
||||
>b : { c: { d?: { e: string; }; }; } | undefined
|
||||
>c : { d?: { e: string; }; } | undefined
|
||||
>o4.b?.c : { d?: { e: string; } | undefined; } | undefined
|
||||
>o4.b : { c: { d?: { e: string; } | undefined; }; } | undefined
|
||||
>o4 : { b?: { c: { d?: { e: string; } | undefined; }; } | undefined; }
|
||||
>b : { c: { d?: { e: string; } | undefined; }; } | undefined
|
||||
>c : { d?: { e: string; } | undefined; } | undefined
|
||||
>d : { e: string; } | undefined
|
||||
>e : string | undefined
|
||||
|
||||
@@ -84,11 +84,11 @@ delete (o4.b?.c.d)?.e;
|
||||
>(o4.b?.c.d)?.e : string | undefined
|
||||
>(o4.b?.c.d) : { e: string; } | undefined
|
||||
>o4.b?.c.d : { e: string; } | undefined
|
||||
>o4.b?.c : { d?: { e: string; }; } | undefined
|
||||
>o4.b : { c: { d?: { e: string; }; }; } | undefined
|
||||
>o4 : { b?: { c: { d?: { e: string; }; }; }; }
|
||||
>b : { c: { d?: { e: string; }; }; } | undefined
|
||||
>c : { d?: { e: string; }; } | undefined
|
||||
>o4.b?.c : { d?: { e: string; } | undefined; } | undefined
|
||||
>o4.b : { c: { d?: { e: string; } | undefined; }; } | undefined
|
||||
>o4 : { b?: { c: { d?: { e: string; } | undefined; }; } | undefined; }
|
||||
>b : { c: { d?: { e: string; } | undefined; }; } | undefined
|
||||
>c : { d?: { e: string; } | undefined; } | undefined
|
||||
>d : { e: string; } | undefined
|
||||
>e : string | undefined
|
||||
|
||||
@@ -97,18 +97,18 @@ delete (o4.b?.c.d?.e);
|
||||
>(o4.b?.c.d?.e) : string | undefined
|
||||
>o4.b?.c.d?.e : string | undefined
|
||||
>o4.b?.c.d : { e: string; } | undefined
|
||||
>o4.b?.c : { d?: { e: string; }; } | undefined
|
||||
>o4.b : { c: { d?: { e: string; }; }; } | undefined
|
||||
>o4 : { b?: { c: { d?: { e: string; }; }; }; }
|
||||
>b : { c: { d?: { e: string; }; }; } | undefined
|
||||
>c : { d?: { e: string; }; } | undefined
|
||||
>o4.b?.c : { d?: { e: string; } | undefined; } | undefined
|
||||
>o4.b : { c: { d?: { e: string; } | undefined; }; } | undefined
|
||||
>o4 : { b?: { c: { d?: { e: string; } | undefined; }; } | undefined; }
|
||||
>b : { c: { d?: { e: string; } | undefined; }; } | undefined
|
||||
>c : { d?: { e: string; } | undefined; } | undefined
|
||||
>d : { e: string; } | undefined
|
||||
>e : string | undefined
|
||||
|
||||
declare const o5: { b?(): { c: { d?: { e: string } } } };
|
||||
>o5 : { b?(): { c: { d?: { e: string; }; };}; }
|
||||
>b : (() => { c: { d?: { e: string; }; };}) | undefined
|
||||
>c : { d?: { e: string;}; }
|
||||
>c : { d?: { e: string; } | undefined; }
|
||||
>d : { e: string; } | undefined
|
||||
>e : string
|
||||
|
||||
@@ -116,12 +116,12 @@ delete o5.b?.().c.d?.e;
|
||||
>delete o5.b?.().c.d?.e : boolean
|
||||
>o5.b?.().c.d?.e : string | undefined
|
||||
>o5.b?.().c.d : { e: string; } | undefined
|
||||
>o5.b?.().c : { d?: { e: string; }; } | undefined
|
||||
>o5.b?.() : { c: { d?: { e: string; }; }; } | undefined
|
||||
>o5.b : (() => { c: { d?: { e: string; }; }; }) | undefined
|
||||
>o5 : { b?(): { c: { d?: { e: string; }; }; }; }
|
||||
>b : (() => { c: { d?: { e: string; }; }; }) | undefined
|
||||
>c : { d?: { e: string; }; } | undefined
|
||||
>o5.b?.().c : { d?: { e: string; } | undefined; } | undefined
|
||||
>o5.b?.() : { c: { d?: { e: string; } | undefined; }; } | undefined
|
||||
>o5.b : (() => { c: { d?: { e: string; } | undefined; }; }) | undefined
|
||||
>o5 : { b?(): { c: { d?: { e: string; } | undefined; }; }; }
|
||||
>b : (() => { c: { d?: { e: string; } | undefined; }; }) | undefined
|
||||
>c : { d?: { e: string; } | undefined; } | undefined
|
||||
>d : { e: string; } | undefined
|
||||
>e : string | undefined
|
||||
|
||||
@@ -130,19 +130,19 @@ delete (o5.b?.().c.d?.e);
|
||||
>(o5.b?.().c.d?.e) : string | undefined
|
||||
>o5.b?.().c.d?.e : string | undefined
|
||||
>o5.b?.().c.d : { e: string; } | undefined
|
||||
>o5.b?.().c : { d?: { e: string; }; } | undefined
|
||||
>o5.b?.() : { c: { d?: { e: string; }; }; } | undefined
|
||||
>o5.b : (() => { c: { d?: { e: string; }; }; }) | undefined
|
||||
>o5 : { b?(): { c: { d?: { e: string; }; }; }; }
|
||||
>b : (() => { c: { d?: { e: string; }; }; }) | undefined
|
||||
>c : { d?: { e: string; }; } | undefined
|
||||
>o5.b?.().c : { d?: { e: string; } | undefined; } | undefined
|
||||
>o5.b?.() : { c: { d?: { e: string; } | undefined; }; } | undefined
|
||||
>o5.b : (() => { c: { d?: { e: string; } | undefined; }; }) | undefined
|
||||
>o5 : { b?(): { c: { d?: { e: string; } | undefined; }; }; }
|
||||
>b : (() => { c: { d?: { e: string; } | undefined; }; }) | undefined
|
||||
>c : { d?: { e: string; } | undefined; } | undefined
|
||||
>d : { e: string; } | undefined
|
||||
>e : string | undefined
|
||||
|
||||
declare const o6: { b?: { c: { d?: { e: string } } } };
|
||||
>o6 : { b?: { c: { d?: { e: string; }; };}; }
|
||||
>o6 : { b?: { c: { d?: { e: string; };}; } | undefined; }
|
||||
>b : { c: { d?: { e: string; };}; } | undefined
|
||||
>c : { d?: { e: string;}; }
|
||||
>c : { d?: { e: string; } | undefined; }
|
||||
>d : { e: string; } | undefined
|
||||
>e : string
|
||||
|
||||
@@ -150,10 +150,10 @@ delete o6.b?.['c'].d?.['e'];
|
||||
>delete o6.b?.['c'].d?.['e'] : boolean
|
||||
>o6.b?.['c'].d?.['e'] : string | undefined
|
||||
>o6.b?.['c'].d : { e: string; } | undefined
|
||||
>o6.b?.['c'] : { d?: { e: string; }; } | undefined
|
||||
>o6.b : { c: { d?: { e: string; }; }; } | undefined
|
||||
>o6 : { b?: { c: { d?: { e: string; }; }; }; }
|
||||
>b : { c: { d?: { e: string; }; }; } | undefined
|
||||
>o6.b?.['c'] : { d?: { e: string; } | undefined; } | undefined
|
||||
>o6.b : { c: { d?: { e: string; } | undefined; }; } | undefined
|
||||
>o6 : { b?: { c: { d?: { e: string; } | undefined; }; } | undefined; }
|
||||
>b : { c: { d?: { e: string; } | undefined; }; } | undefined
|
||||
>'c' : "c"
|
||||
>d : { e: string; } | undefined
|
||||
>'e' : "e"
|
||||
@@ -163,10 +163,10 @@ delete (o6.b?.['c'].d?.['e']);
|
||||
>(o6.b?.['c'].d?.['e']) : string | undefined
|
||||
>o6.b?.['c'].d?.['e'] : string | undefined
|
||||
>o6.b?.['c'].d : { e: string; } | undefined
|
||||
>o6.b?.['c'] : { d?: { e: string; }; } | undefined
|
||||
>o6.b : { c: { d?: { e: string; }; }; } | undefined
|
||||
>o6 : { b?: { c: { d?: { e: string; }; }; }; }
|
||||
>b : { c: { d?: { e: string; }; }; } | undefined
|
||||
>o6.b?.['c'] : { d?: { e: string; } | undefined; } | undefined
|
||||
>o6.b : { c: { d?: { e: string; } | undefined; }; } | undefined
|
||||
>o6 : { b?: { c: { d?: { e: string; } | undefined; }; } | undefined; }
|
||||
>b : { c: { d?: { e: string; } | undefined; }; } | undefined
|
||||
>'c' : "c"
|
||||
>d : { e: string; } | undefined
|
||||
>'e' : "e"
|
||||
|
||||
@@ -1,29 +1,29 @@
|
||||
=== tests/cases/conformance/es6/destructuring/destructuringControlFlow.ts ===
|
||||
function f1(obj: { a?: string }) {
|
||||
>f1 : (obj: { a?: string;}) => void
|
||||
>obj : { a?: string; }
|
||||
>obj : { a?: string | undefined; }
|
||||
>a : string | undefined
|
||||
|
||||
if (obj.a) {
|
||||
>obj.a : string | undefined
|
||||
>obj : { a?: string; }
|
||||
>obj : { a?: string | undefined; }
|
||||
>a : string | undefined
|
||||
|
||||
obj = {};
|
||||
>obj = {} : {}
|
||||
>obj : { a?: string; }
|
||||
>obj : { a?: string | undefined; }
|
||||
>{} : {}
|
||||
|
||||
let a1 = obj["a"]; // string | undefined
|
||||
>a1 : string | undefined
|
||||
>obj["a"] : string | undefined
|
||||
>obj : { a?: string; }
|
||||
>obj : { a?: string | undefined; }
|
||||
>"a" : "a"
|
||||
|
||||
let a2 = obj.a; // string | undefined
|
||||
>a2 : string | undefined
|
||||
>obj.a : string | undefined
|
||||
>obj : { a?: string; }
|
||||
>obj : { a?: string | undefined; }
|
||||
>a : string | undefined
|
||||
}
|
||||
}
|
||||
@@ -96,31 +96,31 @@ function f2(obj: [number, string] | null[]) {
|
||||
|
||||
function f3(obj: { a?: number, b?: string }) {
|
||||
>f3 : (obj: { a?: number; b?: string;}) => void
|
||||
>obj : { a?: number; b?: string; }
|
||||
>obj : { a?: number | undefined; b?: string | undefined; }
|
||||
>a : number | undefined
|
||||
>b : string | undefined
|
||||
|
||||
if (obj.a && obj.b) {
|
||||
>obj.a && obj.b : string | 0 | undefined
|
||||
>obj.a : number | undefined
|
||||
>obj : { a?: number; b?: string; }
|
||||
>obj : { a?: number | undefined; b?: string | undefined; }
|
||||
>a : number | undefined
|
||||
>obj.b : string | undefined
|
||||
>obj : { a?: number; b?: string; }
|
||||
>obj : { a?: number | undefined; b?: string | undefined; }
|
||||
>b : string | undefined
|
||||
|
||||
let { a, b } = obj; // number, string
|
||||
>a : number
|
||||
>b : string
|
||||
>obj : { a?: number; b?: string; }
|
||||
>obj : { a?: number | undefined; b?: string | undefined; }
|
||||
|
||||
({ a, b } = obj);
|
||||
>({ a, b } = obj) : { a?: number; b?: string; }
|
||||
>{ a, b } = obj : { a?: number; b?: string; }
|
||||
>({ a, b } = obj) : { a?: number | undefined; b?: string | undefined; }
|
||||
>{ a, b } = obj : { a?: number | undefined; b?: string | undefined; }
|
||||
>{ a, b } : { a: number; b: string; }
|
||||
>a : number
|
||||
>b : string
|
||||
>obj : { a?: number; b?: string; }
|
||||
>obj : { a?: number | undefined; b?: string | undefined; }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -47,19 +47,19 @@ o3.b?.["c"];
|
||||
>"c" : "c"
|
||||
|
||||
declare const o4: { b?: { c: { d?: { e: string } } } };
|
||||
>o4 : { b?: { c: { d?: { e: string; }; };}; }
|
||||
>o4 : { b?: { c: { d?: { e: string; };}; } | undefined; }
|
||||
>b : { c: { d?: { e: string; };}; } | undefined
|
||||
>c : { d?: { e: string;}; }
|
||||
>c : { d?: { e: string; } | undefined; }
|
||||
>d : { e: string; } | undefined
|
||||
>e : string
|
||||
|
||||
o4.b?.["c"].d?.e;
|
||||
>o4.b?.["c"].d?.e : string | undefined
|
||||
>o4.b?.["c"].d : { e: string; } | undefined
|
||||
>o4.b?.["c"] : { d?: { e: string; }; } | undefined
|
||||
>o4.b : { c: { d?: { e: string; }; }; } | undefined
|
||||
>o4 : { b?: { c: { d?: { e: string; }; }; }; }
|
||||
>b : { c: { d?: { e: string; }; }; } | undefined
|
||||
>o4.b?.["c"] : { d?: { e: string; } | undefined; } | undefined
|
||||
>o4.b : { c: { d?: { e: string; } | undefined; }; } | undefined
|
||||
>o4 : { b?: { c: { d?: { e: string; } | undefined; }; } | undefined; }
|
||||
>b : { c: { d?: { e: string; } | undefined; }; } | undefined
|
||||
>"c" : "c"
|
||||
>d : { e: string; } | undefined
|
||||
>e : string | undefined
|
||||
@@ -67,10 +67,10 @@ o4.b?.["c"].d?.e;
|
||||
o4.b?.["c"].d?.["e"];
|
||||
>o4.b?.["c"].d?.["e"] : string | undefined
|
||||
>o4.b?.["c"].d : { e: string; } | undefined
|
||||
>o4.b?.["c"] : { d?: { e: string; }; } | undefined
|
||||
>o4.b : { c: { d?: { e: string; }; }; } | undefined
|
||||
>o4 : { b?: { c: { d?: { e: string; }; }; }; }
|
||||
>b : { c: { d?: { e: string; }; }; } | undefined
|
||||
>o4.b?.["c"] : { d?: { e: string; } | undefined; } | undefined
|
||||
>o4.b : { c: { d?: { e: string; } | undefined; }; } | undefined
|
||||
>o4 : { b?: { c: { d?: { e: string; } | undefined; }; } | undefined; }
|
||||
>b : { c: { d?: { e: string; } | undefined; }; } | undefined
|
||||
>"c" : "c"
|
||||
>d : { e: string; } | undefined
|
||||
>"e" : "e"
|
||||
@@ -78,18 +78,18 @@ o4.b?.["c"].d?.["e"];
|
||||
declare const o5: { b?(): { c: { d?: { e: string } } } };
|
||||
>o5 : { b?(): { c: { d?: { e: string; }; };}; }
|
||||
>b : (() => { c: { d?: { e: string; }; };}) | undefined
|
||||
>c : { d?: { e: string;}; }
|
||||
>c : { d?: { e: string; } | undefined; }
|
||||
>d : { e: string; } | undefined
|
||||
>e : string
|
||||
|
||||
o5.b?.()["c"].d?.e;
|
||||
>o5.b?.()["c"].d?.e : string | undefined
|
||||
>o5.b?.()["c"].d : { e: string; } | undefined
|
||||
>o5.b?.()["c"] : { d?: { e: string; }; } | undefined
|
||||
>o5.b?.() : { c: { d?: { e: string; }; }; } | undefined
|
||||
>o5.b : (() => { c: { d?: { e: string; }; }; }) | undefined
|
||||
>o5 : { b?(): { c: { d?: { e: string; }; }; }; }
|
||||
>b : (() => { c: { d?: { e: string; }; }; }) | undefined
|
||||
>o5.b?.()["c"] : { d?: { e: string; } | undefined; } | undefined
|
||||
>o5.b?.() : { c: { d?: { e: string; } | undefined; }; } | undefined
|
||||
>o5.b : (() => { c: { d?: { e: string; } | undefined; }; }) | undefined
|
||||
>o5 : { b?(): { c: { d?: { e: string; } | undefined; }; }; }
|
||||
>b : (() => { c: { d?: { e: string; } | undefined; }; }) | undefined
|
||||
>"c" : "c"
|
||||
>d : { e: string; } | undefined
|
||||
>e : string | undefined
|
||||
@@ -97,11 +97,11 @@ o5.b?.()["c"].d?.e;
|
||||
o5.b?.()["c"].d?.["e"];
|
||||
>o5.b?.()["c"].d?.["e"] : string | undefined
|
||||
>o5.b?.()["c"].d : { e: string; } | undefined
|
||||
>o5.b?.()["c"] : { d?: { e: string; }; } | undefined
|
||||
>o5.b?.() : { c: { d?: { e: string; }; }; } | undefined
|
||||
>o5.b : (() => { c: { d?: { e: string; }; }; }) | undefined
|
||||
>o5 : { b?(): { c: { d?: { e: string; }; }; }; }
|
||||
>b : (() => { c: { d?: { e: string; }; }; }) | undefined
|
||||
>o5.b?.()["c"] : { d?: { e: string; } | undefined; } | undefined
|
||||
>o5.b?.() : { c: { d?: { e: string; } | undefined; }; } | undefined
|
||||
>o5.b : (() => { c: { d?: { e: string; } | undefined; }; }) | undefined
|
||||
>o5 : { b?(): { c: { d?: { e: string; } | undefined; }; }; }
|
||||
>b : (() => { c: { d?: { e: string; } | undefined; }; }) | undefined
|
||||
>"c" : "c"
|
||||
>d : { e: string; } | undefined
|
||||
>"e" : "e"
|
||||
@@ -109,10 +109,10 @@ o5.b?.()["c"].d?.["e"];
|
||||
o5["b"]?.()["c"].d?.e;
|
||||
>o5["b"]?.()["c"].d?.e : string | undefined
|
||||
>o5["b"]?.()["c"].d : { e: string; } | undefined
|
||||
>o5["b"]?.()["c"] : { d?: { e: string; }; } | undefined
|
||||
>o5["b"]?.() : { c: { d?: { e: string; }; }; } | undefined
|
||||
>o5["b"] : (() => { c: { d?: { e: string; }; }; }) | undefined
|
||||
>o5 : { b?(): { c: { d?: { e: string; }; }; }; }
|
||||
>o5["b"]?.()["c"] : { d?: { e: string; } | undefined; } | undefined
|
||||
>o5["b"]?.() : { c: { d?: { e: string; } | undefined; }; } | undefined
|
||||
>o5["b"] : (() => { c: { d?: { e: string; } | undefined; }; }) | undefined
|
||||
>o5 : { b?(): { c: { d?: { e: string; } | undefined; }; }; }
|
||||
>"b" : "b"
|
||||
>"c" : "c"
|
||||
>d : { e: string; } | undefined
|
||||
@@ -121,10 +121,10 @@ o5["b"]?.()["c"].d?.e;
|
||||
o5["b"]?.()["c"].d?.["e"];
|
||||
>o5["b"]?.()["c"].d?.["e"] : string | undefined
|
||||
>o5["b"]?.()["c"].d : { e: string; } | undefined
|
||||
>o5["b"]?.()["c"] : { d?: { e: string; }; } | undefined
|
||||
>o5["b"]?.() : { c: { d?: { e: string; }; }; } | undefined
|
||||
>o5["b"] : (() => { c: { d?: { e: string; }; }; }) | undefined
|
||||
>o5 : { b?(): { c: { d?: { e: string; }; }; }; }
|
||||
>o5["b"]?.()["c"] : { d?: { e: string; } | undefined; } | undefined
|
||||
>o5["b"]?.() : { c: { d?: { e: string; } | undefined; }; } | undefined
|
||||
>o5["b"] : (() => { c: { d?: { e: string; } | undefined; }; }) | undefined
|
||||
>o5 : { b?(): { c: { d?: { e: string; } | undefined; }; }; }
|
||||
>"b" : "b"
|
||||
>"c" : "c"
|
||||
>d : { e: string; } | undefined
|
||||
|
||||
@@ -3,7 +3,7 @@ function f<TType>(
|
||||
>f : <TType>(a: { weak?: string;} & Readonly<TType> & { name: "ok";}, b: Readonly<TType & { name: string;}>, c: Readonly<TType> & { name: string;}) => void
|
||||
|
||||
a: { weak?: string } & Readonly<TType> & { name: "ok" },
|
||||
>a : { weak?: string; } & Readonly<TType> & { name: "ok"; }
|
||||
>a : { weak?: string | undefined; } & Readonly<TType> & { name: "ok"; }
|
||||
>weak : string | undefined
|
||||
>name : "ok"
|
||||
|
||||
@@ -16,13 +16,13 @@ function f<TType>(
|
||||
>name : string
|
||||
|
||||
c = a; // Works
|
||||
>c = a : { weak?: string; } & Readonly<TType> & { name: "ok"; }
|
||||
>c = a : { weak?: string | undefined; } & Readonly<TType> & { name: "ok"; }
|
||||
>c : Readonly<TType> & { name: string; }
|
||||
>a : { weak?: string; } & Readonly<TType> & { name: "ok"; }
|
||||
>a : { weak?: string | undefined; } & Readonly<TType> & { name: "ok"; }
|
||||
|
||||
b = a; // Should also work
|
||||
>b = a : { weak?: string; } & Readonly<TType> & { name: "ok"; }
|
||||
>b = a : { weak?: string | undefined; } & Readonly<TType> & { name: "ok"; }
|
||||
>b : Readonly<TType & { name: string; }>
|
||||
>a : { weak?: string; } & Readonly<TType> & { name: "ok"; }
|
||||
>a : { weak?: string | undefined; } & Readonly<TType> & { name: "ok"; }
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ declare const x2: { a: string, b: number | undefined };
|
||||
>b : number | undefined
|
||||
|
||||
declare const x3: { a: string, b?: number };
|
||||
>x3 : { a: string; b?: number; }
|
||||
>x3 : { a: string; b?: number | undefined; }
|
||||
>a : string
|
||||
>b : number | undefined
|
||||
|
||||
@@ -40,11 +40,11 @@ let a3 = foo(x3); // string | number
|
||||
>a3 : string | number
|
||||
>foo(x3) : string | number
|
||||
>foo : <T>(obj: { [x: string]: T; }) => T
|
||||
>x3 : { a: string; b?: number; }
|
||||
>x3 : { a: string; b?: number | undefined; }
|
||||
|
||||
let a4 = foo(x4); // string | number
|
||||
>a4 : string | number | undefined
|
||||
>foo(x4) : string | number | undefined
|
||||
>a4 : string | number
|
||||
>foo(x4) : string | number
|
||||
>foo : <T>(obj: { [x: string]: T; }) => T
|
||||
>x4 : { a: string; b?: number | undefined; }
|
||||
|
||||
@@ -63,8 +63,8 @@ const param2 = Math.random() < 0.5 ? 'value2' : null;
|
||||
>null : null
|
||||
|
||||
const obj = {
|
||||
>obj : { param2?: string; param1: string; }
|
||||
>{ param1: 'value1', ...(param2 ? {param2} : {})} : { param2?: string; param1: string; }
|
||||
>obj : { param2?: string | undefined; param1: string; }
|
||||
>{ param1: 'value1', ...(param2 ? {param2} : {})} : { param2?: string | undefined; param1: string; }
|
||||
|
||||
param1: 'value1',
|
||||
>param1 : string
|
||||
@@ -90,7 +90,7 @@ const query = Object.entries(obj).map(
|
||||
>Object.entries : { <T>(o: { [s: string]: T; } | ArrayLike<T>): [string, T][]; (o: {}): [string, any][]; }
|
||||
>Object : ObjectConstructor
|
||||
>entries : { <T>(o: { [s: string]: T; } | ArrayLike<T>): [string, T][]; (o: {}): [string, any][]; }
|
||||
>obj : { param2?: string; param1: string; }
|
||||
>obj : { param2?: string | undefined; param1: string; }
|
||||
>map : <U>(callbackfn: (value: [string, string], index: number, array: [string, string][]) => U, thisArg?: any) => U[]
|
||||
|
||||
([k, v]) => `${k}=${encodeURIComponent(v)}`
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
=== tests/cases/compiler/index.d.ts ===
|
||||
export declare function foo({a}?: {
|
||||
>foo : ({ a }?: { a?: string; } | undefined) => void
|
||||
>foo : ({ a }?: { a?: string | undefined; } | undefined) => void
|
||||
>a : string | undefined
|
||||
|
||||
a?: string;
|
||||
|
||||
@@ -221,7 +221,7 @@ interface ComponentClass<P = {}> {
|
||||
}
|
||||
|
||||
type CreateElementChildren<P> =
|
||||
>CreateElementChildren : P extends { children?: infer C; } ? C extends any[] ? C : C[] : unknown
|
||||
>CreateElementChildren : P extends { children?: infer C | undefined; } ? C extends any[] ? C : C[] : unknown
|
||||
|
||||
P extends { children?: infer C }
|
||||
>children : C | undefined
|
||||
@@ -232,24 +232,24 @@ type CreateElementChildren<P> =
|
||||
: unknown;
|
||||
|
||||
declare function createElement<P extends {}>(
|
||||
>createElement : <P extends {}>(type: ComponentClass<P>, ...children: P extends { children?: infer C; } ? C extends any[] ? C : C[] : unknown) => any
|
||||
>createElement : <P extends {}>(type: ComponentClass<P>, ...children: P extends { children?: infer C | undefined; } ? C extends any[] ? C : C[] : unknown) => any
|
||||
|
||||
type: ComponentClass<P>,
|
||||
>type : ComponentClass<P>
|
||||
|
||||
...children: CreateElementChildren<P>
|
||||
>children : P extends { children?: infer C; } ? C extends any[] ? C : C[] : unknown
|
||||
>children : P extends { children?: infer C | undefined; } ? C extends any[] ? C : C[] : unknown
|
||||
|
||||
): any;
|
||||
|
||||
declare function createElement2<P extends {}>(
|
||||
>createElement2 : <P extends {}>(type: ComponentClass<P>, child: P extends { children?: infer C; } ? C extends any[] ? C : C[] : unknown) => any
|
||||
>createElement2 : <P extends {}>(type: ComponentClass<P>, child: P extends { children?: infer C | undefined; } ? C extends any[] ? C : C[] : unknown) => any
|
||||
|
||||
type: ComponentClass<P>,
|
||||
>type : ComponentClass<P>
|
||||
|
||||
child: CreateElementChildren<P>
|
||||
>child : P extends { children?: infer C; } ? C extends any[] ? C : C[] : unknown
|
||||
>child : P extends { children?: infer C | undefined; } ? C extends any[] ? C : C[] : unknown
|
||||
|
||||
): any;
|
||||
|
||||
@@ -261,7 +261,7 @@ class InferFunctionTypes extends Component<{children: (foo: number) => string}>
|
||||
|
||||
createElement(InferFunctionTypes, (foo) => "" + foo);
|
||||
>createElement(InferFunctionTypes, (foo) => "" + foo) : any
|
||||
>createElement : <P extends {}>(type: ComponentClass<P>, ...children: P extends { children?: infer C; } ? C extends any[] ? C : C[] : unknown) => any
|
||||
>createElement : <P extends {}>(type: ComponentClass<P>, ...children: P extends { children?: infer C | undefined; } ? C extends any[] ? C : C[] : unknown) => any
|
||||
>InferFunctionTypes : typeof InferFunctionTypes
|
||||
>(foo) => "" + foo : (foo: number) => string
|
||||
>foo : number
|
||||
@@ -271,7 +271,7 @@ createElement(InferFunctionTypes, (foo) => "" + foo);
|
||||
|
||||
createElement2(InferFunctionTypes, [(foo) => "" + foo]);
|
||||
>createElement2(InferFunctionTypes, [(foo) => "" + foo]) : any
|
||||
>createElement2 : <P extends {}>(type: ComponentClass<P>, child: P extends { children?: infer C; } ? C extends any[] ? C : C[] : unknown) => any
|
||||
>createElement2 : <P extends {}>(type: ComponentClass<P>, child: P extends { children?: infer C | undefined; } ? C extends any[] ? C : C[] : unknown) => any
|
||||
>InferFunctionTypes : typeof InferFunctionTypes
|
||||
>[(foo) => "" + foo] : ((foo: number) => string)[]
|
||||
>(foo) => "" + foo : (foo: number) => string
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
tests/cases/compiler/intersectionPropertyCheck.ts(1,68): error TS2322: Type '{ x: string; y: number; }' is not assignable to type '{ x: string; }'.
|
||||
Object literal may only specify known properties, and 'y' does not exist in type '{ x: string; }'.
|
||||
tests/cases/compiler/intersectionPropertyCheck.ts(4,5): error TS2322: Type '{ a: { y: string; }; }' is not assignable to type '{ a?: { x?: number; }; } & { c?: string; }'.
|
||||
tests/cases/compiler/intersectionPropertyCheck.ts(4,5): error TS2322: Type '{ a: { y: string; }; }' is not assignable to type '{ a?: { x?: number | undefined; } | undefined; } & { c?: string | undefined; }'.
|
||||
Types of property 'a' are incompatible.
|
||||
Type '{ y: string; }' has no properties in common with type '{ x?: number; }'.
|
||||
tests/cases/compiler/intersectionPropertyCheck.ts(7,3): error TS2322: Type 'T & { a: boolean; }' is not assignable to type '{ a?: string; }'.
|
||||
Type '{ y: string; }' has no properties in common with type '{ x?: number | undefined; }'.
|
||||
tests/cases/compiler/intersectionPropertyCheck.ts(7,3): error TS2322: Type 'T & { a: boolean; }' is not assignable to type '{ a?: string | undefined; }'.
|
||||
Types of property 'a' are incompatible.
|
||||
Type 'boolean' is not assignable to type 'string'.
|
||||
tests/cases/compiler/intersectionPropertyCheck.ts(17,22): error TS2322: Type 'boolean' is not assignable to type 'string[]'.
|
||||
Type 'boolean' is not assignable to type 'string | undefined'.
|
||||
tests/cases/compiler/intersectionPropertyCheck.ts(17,22): error TS2322: Type 'true' is not assignable to type 'string[] | undefined'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/intersectionPropertyCheck.ts (4 errors) ====
|
||||
@@ -19,16 +19,16 @@ tests/cases/compiler/intersectionPropertyCheck.ts(17,22): error TS2322: Type 'bo
|
||||
declare let wrong: { a: { y: string } };
|
||||
let weak: { a?: { x?: number } } & { c?: string } = wrong; // Nested weak object type
|
||||
~~~~
|
||||
!!! error TS2322: Type '{ a: { y: string; }; }' is not assignable to type '{ a?: { x?: number; }; } & { c?: string; }'.
|
||||
!!! error TS2322: Type '{ a: { y: string; }; }' is not assignable to type '{ a?: { x?: number | undefined; } | undefined; } & { c?: string | undefined; }'.
|
||||
!!! error TS2322: Types of property 'a' are incompatible.
|
||||
!!! error TS2322: Type '{ y: string; }' has no properties in common with type '{ x?: number; }'.
|
||||
!!! error TS2322: Type '{ y: string; }' has no properties in common with type '{ x?: number | undefined; }'.
|
||||
|
||||
function foo<T extends object>(x: { a?: string }, y: T & { a: boolean }) {
|
||||
x = y; // Mismatched property in source intersection
|
||||
~
|
||||
!!! error TS2322: Type 'T & { a: boolean; }' is not assignable to type '{ a?: string; }'.
|
||||
!!! error TS2322: Type 'T & { a: boolean; }' is not assignable to type '{ a?: string | undefined; }'.
|
||||
!!! error TS2322: Types of property 'a' are incompatible.
|
||||
!!! error TS2322: Type 'boolean' is not assignable to type 'string'.
|
||||
!!! error TS2322: Type 'boolean' is not assignable to type 'string | undefined'.
|
||||
}
|
||||
|
||||
// Repro from #36637
|
||||
@@ -40,7 +40,7 @@ tests/cases/compiler/intersectionPropertyCheck.ts(17,22): error TS2322: Type 'bo
|
||||
function test<T extends object>(value: T): Test {
|
||||
return { ...value, hi: true }
|
||||
~~
|
||||
!!! error TS2322: Type 'boolean' is not assignable to type 'string[]'.
|
||||
!!! error TS2322: Type 'true' is not assignable to type 'string[] | undefined'.
|
||||
!!! related TS6500 tests/cases/compiler/intersectionPropertyCheck.ts:13:12: The expected type comes from property 'hi' which is declared here on type 'Test'
|
||||
}
|
||||
|
||||
@@ -20,22 +20,22 @@ declare let wrong: { a: { y: string } };
|
||||
>y : string
|
||||
|
||||
let weak: { a?: { x?: number } } & { c?: string } = wrong; // Nested weak object type
|
||||
>weak : { a?: { x?: number;}; } & { c?: string; }
|
||||
>a : { x?: number; } | undefined
|
||||
>weak : { a?: { x?: number | undefined; } | undefined; } & { c?: string | undefined; }
|
||||
>a : { x?: number | undefined; } | undefined
|
||||
>x : number | undefined
|
||||
>c : string | undefined
|
||||
>wrong : { a: { y: string; }; }
|
||||
|
||||
function foo<T extends object>(x: { a?: string }, y: T & { a: boolean }) {
|
||||
>foo : <T extends object>(x: { a?: string;}, y: T & { a: boolean;}) => void
|
||||
>x : { a?: string; }
|
||||
>x : { a?: string | undefined; }
|
||||
>a : string | undefined
|
||||
>y : T & { a: boolean; }
|
||||
>a : boolean
|
||||
|
||||
x = y; // Mismatched property in source intersection
|
||||
>x = y : T & { a: boolean; }
|
||||
>x : { a?: string; }
|
||||
>x : { a?: string | undefined; }
|
||||
>y : T & { a: boolean; }
|
||||
}
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
tests/cases/compiler/intersectionsAndOptionalProperties.ts(5,1): error TS2322: Type '{ a: null; b: string; }' is not assignable to type '{ a?: number; b: string; }'.
|
||||
tests/cases/compiler/intersectionsAndOptionalProperties.ts(5,1): error TS2322: Type '{ a: null; b: string; }' is not assignable to type '{ a?: number | undefined; b: string; }'.
|
||||
Types of property 'a' are incompatible.
|
||||
Type 'null' is not assignable to type 'number'.
|
||||
tests/cases/compiler/intersectionsAndOptionalProperties.ts(6,1): error TS2322: Type '{ a: null; } & { b: string; }' is not assignable to type '{ a?: number; b: string; }'.
|
||||
Type 'null' is not assignable to type 'number | undefined'.
|
||||
tests/cases/compiler/intersectionsAndOptionalProperties.ts(6,1): error TS2322: Type '{ a: null; } & { b: string; }' is not assignable to type '{ a?: number | undefined; b: string; }'.
|
||||
Types of property 'a' are incompatible.
|
||||
Type 'null' is not assignable to type 'number'.
|
||||
Type 'null' is not assignable to type 'number | undefined'.
|
||||
tests/cases/compiler/intersectionsAndOptionalProperties.ts(19,5): error TS2322: Type 'From' is not assignable to type 'To'.
|
||||
Types of property 'field' are incompatible.
|
||||
Type 'null' is not assignable to type 'number'.
|
||||
tests/cases/compiler/intersectionsAndOptionalProperties.ts(20,5): error TS2322: Type 'null' is not assignable to type 'number'.
|
||||
Type 'null' is not assignable to type 'number | undefined'.
|
||||
tests/cases/compiler/intersectionsAndOptionalProperties.ts(20,5): error TS2322: Type 'null' is not assignable to type 'number | undefined'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/intersectionsAndOptionalProperties.ts (4 errors) ====
|
||||
@@ -17,14 +17,14 @@ tests/cases/compiler/intersectionsAndOptionalProperties.ts(20,5): error TS2322:
|
||||
|
||||
x = y; // Error
|
||||
~
|
||||
!!! error TS2322: Type '{ a: null; b: string; }' is not assignable to type '{ a?: number; b: string; }'.
|
||||
!!! error TS2322: Type '{ a: null; b: string; }' is not assignable to type '{ a?: number | undefined; b: string; }'.
|
||||
!!! error TS2322: Types of property 'a' are incompatible.
|
||||
!!! error TS2322: Type 'null' is not assignable to type 'number'.
|
||||
!!! error TS2322: Type 'null' is not assignable to type 'number | undefined'.
|
||||
x = z; // Error
|
||||
~
|
||||
!!! error TS2322: Type '{ a: null; } & { b: string; }' is not assignable to type '{ a?: number; b: string; }'.
|
||||
!!! error TS2322: Type '{ a: null; } & { b: string; }' is not assignable to type '{ a?: number | undefined; b: string; }'.
|
||||
!!! error TS2322: Types of property 'a' are incompatible.
|
||||
!!! error TS2322: Type 'null' is not assignable to type 'number'.
|
||||
!!! error TS2322: Type 'null' is not assignable to type 'number | undefined'.
|
||||
|
||||
// Repro from #36604
|
||||
|
||||
@@ -41,10 +41,10 @@ tests/cases/compiler/intersectionsAndOptionalProperties.ts(20,5): error TS2322:
|
||||
~
|
||||
!!! error TS2322: Type 'From' is not assignable to type 'To'.
|
||||
!!! error TS2322: Types of property 'field' are incompatible.
|
||||
!!! error TS2322: Type 'null' is not assignable to type 'number'.
|
||||
!!! error TS2322: Type 'null' is not assignable to type 'number | undefined'.
|
||||
x.field = v.field; // Error
|
||||
~~~~~~~
|
||||
!!! error TS2322: Type 'null' is not assignable to type 'number'.
|
||||
!!! error TS2322: Type 'null' is not assignable to type 'number | undefined'.
|
||||
}
|
||||
|
||||
// Repro from #38348
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
=== tests/cases/compiler/intersectionsAndOptionalProperties.ts ===
|
||||
declare let x: { a?: number, b: string };
|
||||
>x : { a?: number; b: string; }
|
||||
>x : { a?: number | undefined; b: string; }
|
||||
>a : number | undefined
|
||||
>b : string
|
||||
|
||||
@@ -18,12 +18,12 @@ declare let z: { a: null } & { b: string };
|
||||
|
||||
x = y; // Error
|
||||
>x = y : { a: null; b: string; }
|
||||
>x : { a?: number; b: string; }
|
||||
>x : { a?: number | undefined; b: string; }
|
||||
>y : { a: null; b: string; }
|
||||
|
||||
x = z; // Error
|
||||
>x = z : { a: null; } & { b: string; }
|
||||
>x : { a?: number; b: string; }
|
||||
>x : { a?: number | undefined; b: string; }
|
||||
>z : { a: null; } & { b: string; }
|
||||
|
||||
// Repro from #36604
|
||||
@@ -55,9 +55,9 @@ function foo(v: From) {
|
||||
|
||||
x.field = v.field; // Error
|
||||
>x.field = v.field : null
|
||||
>x.field : number
|
||||
>x.field : number | undefined
|
||||
>x : To
|
||||
>field : number
|
||||
>field : number | undefined
|
||||
>v.field : null
|
||||
>v : From
|
||||
>field : null
|
||||
|
||||
@@ -61,7 +61,7 @@ import React from "react";
|
||||
*/
|
||||
const TabbedShowLayout = () => {
|
||||
>TabbedShowLayout : React.SFC<{}>
|
||||
>() => { return ( <div className="" key=""> ok </div> );} : { (): JSX.Element; defaultProps: Partial<{}>; }
|
||||
>() => { return ( <div className="" key=""> ok </div> );} : { (): JSX.Element; defaultProps: Partial<{}> | undefined; }
|
||||
|
||||
return (
|
||||
>( <div className="" key=""> ok </div> ) : JSX.Element
|
||||
@@ -81,9 +81,9 @@ const TabbedShowLayout = () => {
|
||||
|
||||
TabbedShowLayout.defaultProps = {
|
||||
>TabbedShowLayout.defaultProps = { tabs: "default value"} : { tabs: string; }
|
||||
>TabbedShowLayout.defaultProps : Partial<{}>
|
||||
>TabbedShowLayout.defaultProps : Partial<{}> | undefined
|
||||
>TabbedShowLayout : React.SFC<{}>
|
||||
>defaultProps : Partial<{}>
|
||||
>defaultProps : Partial<{}> | undefined
|
||||
>{ tabs: "default value"} : { tabs: string; }
|
||||
|
||||
tabs: "default value"
|
||||
|
||||
@@ -1,626 +0,0 @@
|
||||
tests/cases/compiler/jsxComplexSignatureHasApplicabilityError.tsx(31,17): error TS2769: No overload matches this call.
|
||||
Overload 1 of 2, '(props: Readonly<ReactSelectProps<ExtractValueType<WrappedProps>>>): ReactSelectClass<ExtractValueType<WrappedProps>>', gave the following error.
|
||||
Type 'ExtractValueType<WrappedProps> | Option<ExtractValueType<WrappedProps>> | undefined' is not assignable to type 'string | number | boolean | string[] | number[] | Option<ExtractValueType<WrappedProps>> | Options<ExtractValueType<WrappedProps>>'.
|
||||
Type 'undefined' is not assignable to type 'string | number | boolean | string[] | number[] | Option<ExtractValueType<WrappedProps>> | Options<ExtractValueType<WrappedProps>>'.
|
||||
Overload 2 of 2, '(props: ReactSelectProps<ExtractValueType<WrappedProps>>, context?: any): ReactSelectClass<ExtractValueType<WrappedProps>>', gave the following error.
|
||||
Type 'ExtractValueType<WrappedProps> | Option<ExtractValueType<WrappedProps>> | undefined' is not assignable to type 'string | number | boolean | string[] | number[] | Option<ExtractValueType<WrappedProps>> | Options<ExtractValueType<WrappedProps>>'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/jsxComplexSignatureHasApplicabilityError.tsx (1 errors) ====
|
||||
/// <reference path="/.lib/react16.d.ts" />
|
||||
|
||||
import * as React from "react";
|
||||
|
||||
|
||||
interface Props<T extends OptionValues> {
|
||||
value?: Option<T> | T;
|
||||
onChange?(value: Option<T> | undefined): void;
|
||||
}
|
||||
|
||||
type ExtractValueType<T> = T extends ReactSelectProps<infer U> ? U : never;
|
||||
|
||||
export type ReactSingleSelectProps<
|
||||
WrappedProps extends ReactSelectProps<any>
|
||||
> = Overwrite<
|
||||
Omit<WrappedProps, "multi">,
|
||||
Props<ExtractValueType<WrappedProps>>
|
||||
>;
|
||||
|
||||
export function createReactSingleSelect<
|
||||
WrappedProps extends ReactSelectProps<any>
|
||||
>(
|
||||
WrappedComponent: React.ComponentType<WrappedProps>
|
||||
): React.ComponentType<ReactSingleSelectProps<WrappedProps>> {
|
||||
return (props) => {
|
||||
return (
|
||||
<ReactSelectClass<ExtractValueType<WrappedProps>>
|
||||
{...props}
|
||||
multi={false}
|
||||
autosize={false}
|
||||
value={props.value}
|
||||
~~~~~
|
||||
!!! error TS2769: No overload matches this call.
|
||||
!!! error TS2769: Overload 1 of 2, '(props: Readonly<ReactSelectProps<ExtractValueType<WrappedProps>>>): ReactSelectClass<ExtractValueType<WrappedProps>>', gave the following error.
|
||||
!!! error TS2769: Type 'ExtractValueType<WrappedProps> | Option<ExtractValueType<WrappedProps>> | undefined' is not assignable to type 'string | number | boolean | string[] | number[] | Option<ExtractValueType<WrappedProps>> | Options<ExtractValueType<WrappedProps>>'.
|
||||
!!! error TS2769: Type 'undefined' is not assignable to type 'string | number | boolean | string[] | number[] | Option<ExtractValueType<WrappedProps>> | Options<ExtractValueType<WrappedProps>>'.
|
||||
!!! error TS2769: Overload 2 of 2, '(props: ReactSelectProps<ExtractValueType<WrappedProps>>, context?: any): ReactSelectClass<ExtractValueType<WrappedProps>>', gave the following error.
|
||||
!!! error TS2769: Type 'ExtractValueType<WrappedProps> | Option<ExtractValueType<WrappedProps>> | undefined' is not assignable to type 'string | number | boolean | string[] | number[] | Option<ExtractValueType<WrappedProps>> | Options<ExtractValueType<WrappedProps>>'.
|
||||
!!! related TS6500 tests/cases/compiler/jsxComplexSignatureHasApplicabilityError.tsx:567:5: The expected type comes from property 'value' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes<ReactSelectClass<ExtractValueType<WrappedProps>>> & Readonly<{ children?: ReactNode; }> & Readonly<ReactSelectProps<ExtractValueType<WrappedProps>>>'
|
||||
!!! related TS6500 tests/cases/compiler/jsxComplexSignatureHasApplicabilityError.tsx:567:5: The expected type comes from property 'value' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes<ReactSelectClass<ExtractValueType<WrappedProps>>> & Readonly<{ children?: ReactNode; }> & Readonly<ReactSelectProps<ExtractValueType<WrappedProps>>>'
|
||||
onChange={(value) => {
|
||||
if (props.onChange) {
|
||||
props.onChange(value === null ? undefined : value);
|
||||
}
|
||||
}}
|
||||
/>
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
// Copied from "type-zoo" version 3.4.0
|
||||
export type Omit<T, K extends keyof any> = T extends any ? Pick<T, Exclude<keyof T, K>> : never;
|
||||
export type Overwrite<T, U> = Omit<T, keyof T & keyof U> & U;
|
||||
|
||||
// Everything below here copied from "@types/react-select" version 1.3.4
|
||||
declare class ReactSelectClass<TValue = OptionValues> extends React.Component<ReactSelectProps<TValue>> {
|
||||
focus(): void;
|
||||
setValue(value: Option<TValue>): void;
|
||||
}
|
||||
|
||||
export type OptionComponentType<TValue = OptionValues> = React.ComponentType<OptionComponentProps<TValue>>;
|
||||
export type ValueComponentType<TValue = OptionValues> = React.ComponentType<ValueComponentProps<TValue>>;
|
||||
|
||||
export type HandlerRendererResult = JSX.Element | null | false;
|
||||
|
||||
// Handlers
|
||||
export type FocusOptionHandler<TValue = OptionValues> = (option: Option<TValue>) => void;
|
||||
export type SelectValueHandler<TValue = OptionValues> = (option: Option<TValue>) => void;
|
||||
export type ArrowRendererHandler = (props: ArrowRendererProps) => HandlerRendererResult;
|
||||
export type ClearRendererHandler = () => HandlerRendererResult;
|
||||
export type FilterOptionHandler<TValue = OptionValues> = (option: Option<TValue>, filter: string) => boolean;
|
||||
export type FilterOptionsHandler<TValue = OptionValues> = (options: Options<TValue>, filter: string, currentValues: Options<TValue>) => Options<TValue>;
|
||||
export type InputRendererHandler = (props: { [key: string]: any }) => HandlerRendererResult;
|
||||
export type MenuRendererHandler<TValue = OptionValues> = (props: MenuRendererProps<TValue>) => HandlerRendererResult;
|
||||
export type OnCloseHandler = () => void;
|
||||
export type OnInputChangeHandler = (inputValue: string) => string;
|
||||
export type OnInputKeyDownHandler = React.KeyboardEventHandler<HTMLDivElement | HTMLInputElement>;
|
||||
export type OnMenuScrollToBottomHandler = () => void;
|
||||
export type OnOpenHandler = () => void;
|
||||
export type OnFocusHandler = React.FocusEventHandler<HTMLDivElement | HTMLInputElement>;
|
||||
export type OnBlurHandler = React.FocusEventHandler<HTMLDivElement | HTMLInputElement>;
|
||||
export type OptionRendererHandler<TValue = OptionValues> = (option: Option<TValue>) => HandlerRendererResult;
|
||||
export type ValueRendererHandler<TValue = OptionValues> = (option: Option<TValue>, index?: number) => HandlerRendererResult;
|
||||
export type OnValueClickHandler<TValue = OptionValues> = (option: Option<TValue>, event: React.MouseEvent<HTMLAnchorElement>) => void;
|
||||
export type IsOptionUniqueHandler<TValue = OptionValues> = (arg: { option: Option<TValue>, options: Options<TValue>, labelKey: string, valueKey: string }) => boolean;
|
||||
export type IsValidNewOptionHandler = (arg: { label: string }) => boolean;
|
||||
export type NewOptionCreatorHandler<TValue = OptionValues> = (arg: { label: string, labelKey: string, valueKey: string }) => Option<TValue>;
|
||||
export type PromptTextCreatorHandler = (filterText: string) => string;
|
||||
export type ShouldKeyDownEventCreateNewOptionHandler = (arg: { keyCode: number }) => boolean;
|
||||
|
||||
export type OnChangeSingleHandler<TValue = OptionValues> = OnChangeHandler<TValue, Option<TValue>>;
|
||||
export type OnChangeMultipleHandler<TValue = OptionValues> = OnChangeHandler<TValue, Options<TValue>>;
|
||||
export type OnChangeHandler<TValue = OptionValues, TOption = Option<TValue> | Options<TValue>> = (newValue: TOption | null) => void;
|
||||
export type OnNewOptionClickHandler<TValue = OptionValues> = (option: Option<TValue>) => void;
|
||||
|
||||
export type LoadOptionsHandler<TValue = OptionValues> = LoadOptionsAsyncHandler<TValue> | LoadOptionsLegacyHandler<TValue>;
|
||||
export type LoadOptionsAsyncHandler<TValue = OptionValues> = (input: string) => Promise<AutocompleteResult<TValue>>;
|
||||
export type LoadOptionsLegacyHandler<TValue = OptionValues> = (input: string, callback: (err: any, result: AutocompleteResult<TValue>) => void) => void;
|
||||
|
||||
export interface AutocompleteResult<TValue = OptionValues> {
|
||||
/** The search-results to be displayed */
|
||||
options: Options<TValue>;
|
||||
/**
|
||||
* Should be set to true, if and only if a longer query with the same prefix
|
||||
* would return a subset of the results
|
||||
* If set to true, more specific queries will not be sent to the server.
|
||||
*/
|
||||
complete: boolean;
|
||||
}
|
||||
|
||||
export type Options<TValue = OptionValues> = Array<Option<TValue>>;
|
||||
|
||||
export interface Option<TValue = OptionValues> {
|
||||
/** Text for rendering */
|
||||
label?: string;
|
||||
/** Value for searching */
|
||||
value?: TValue;
|
||||
/**
|
||||
* Allow this option to be cleared
|
||||
* @default true
|
||||
*/
|
||||
clearableValue?: boolean;
|
||||
/**
|
||||
* Do not allow this option to be selected
|
||||
* @default false
|
||||
*/
|
||||
disabled?: boolean;
|
||||
/**
|
||||
* In the event that a custom menuRenderer is provided, Option should be able
|
||||
* to accept arbitrary key-value pairs. See react-virtualized-select.
|
||||
*/
|
||||
[property: string]: any;
|
||||
}
|
||||
|
||||
export type OptionValues = string | number | boolean;
|
||||
|
||||
export interface MenuRendererProps<TValue = OptionValues> {
|
||||
/**
|
||||
* The currently focused option; should be visible in the menu by default.
|
||||
* default {}
|
||||
*/
|
||||
focusedOption: Option<TValue>;
|
||||
|
||||
/**
|
||||
* Callback to focus a new option; receives the option as a parameter.
|
||||
*/
|
||||
focusOption: FocusOptionHandler<TValue>;
|
||||
|
||||
/**
|
||||
* Option labels are accessible with this string key.
|
||||
*/
|
||||
labelKey: string;
|
||||
|
||||
/**
|
||||
* Ordered array of options to render.
|
||||
*/
|
||||
options: Options<TValue>;
|
||||
|
||||
/**
|
||||
* Callback to select a new option; receives the option as a parameter.
|
||||
*/
|
||||
selectValue: SelectValueHandler<TValue>;
|
||||
|
||||
/**
|
||||
* Array of currently selected options.
|
||||
*/
|
||||
valueArray: Options<TValue>;
|
||||
|
||||
/**
|
||||
* Callback to remove selection from option; receives the option as a parameter.
|
||||
*/
|
||||
removeValue: SelectValueHandler<TValue>;
|
||||
|
||||
/**
|
||||
* function which returns a custom way to render the options in the menu
|
||||
*/
|
||||
optionRenderer: OptionRendererHandler<TValue>;
|
||||
}
|
||||
|
||||
export interface OptionComponentProps<TValue = OptionValues> {
|
||||
/**
|
||||
* Classname(s) to apply to the option component.
|
||||
*/
|
||||
className?: string;
|
||||
|
||||
/**
|
||||
* Currently focused option.
|
||||
*/
|
||||
focusOption?: Option<TValue>;
|
||||
|
||||
inputValue?: string;
|
||||
instancePrefix?: string;
|
||||
|
||||
/**
|
||||
* True if this option is disabled.
|
||||
*/
|
||||
isDisabled?: boolean;
|
||||
|
||||
/**
|
||||
* True if this option is focused.
|
||||
*/
|
||||
isFocused?: boolean;
|
||||
|
||||
/**
|
||||
* True if this option is selected.
|
||||
*/
|
||||
isSelected?: boolean;
|
||||
|
||||
/**
|
||||
* Callback to be invoked when this option is focused.
|
||||
*/
|
||||
onFocus?: (option: Option<TValue>, event: any) => void;
|
||||
|
||||
/**
|
||||
* Callback to be invoked when this option is selected.
|
||||
*/
|
||||
onSelect?: (option: Option<TValue>, event: any) => void;
|
||||
|
||||
/**
|
||||
* Option to be rendered by this component.
|
||||
*/
|
||||
option: Option<TValue>;
|
||||
|
||||
/**
|
||||
* Index of the option being rendered in the list
|
||||
*/
|
||||
optionIndex?: number;
|
||||
|
||||
/**
|
||||
* Callback to invoke when removing an option from a multi-selection. (Not necessarily the one
|
||||
* being rendered)
|
||||
*/
|
||||
removeValue?: (value: TValue | TValue[]) => void;
|
||||
|
||||
/**
|
||||
* Callback to invoke to select an option. (Not necessarily the one being rendered)
|
||||
*/
|
||||
selectValue?: (value: TValue | TValue[]) => void;
|
||||
}
|
||||
|
||||
export interface ArrowRendererProps {
|
||||
/**
|
||||
* Arrow mouse down event handler.
|
||||
*/
|
||||
onMouseDown: React.MouseEventHandler<any>;
|
||||
|
||||
/**
|
||||
* whether the Select is open or not.
|
||||
*/
|
||||
isOpen: boolean;
|
||||
}
|
||||
|
||||
export interface ValueComponentProps<TValue = OptionValues> {
|
||||
disabled: ReactSelectProps<TValue>['disabled'];
|
||||
id: string;
|
||||
instancePrefix: string;
|
||||
onClick: OnValueClickHandler<TValue> | null;
|
||||
onRemove?: SelectValueHandler<TValue>;
|
||||
placeholder: ReactSelectProps<TValue>['placeholder'];
|
||||
value: Option<TValue>;
|
||||
values?: Array<Option<TValue>>;
|
||||
}
|
||||
|
||||
export interface ReactSelectProps<TValue = OptionValues> extends React.Props<ReactSelectClass<TValue>> {
|
||||
/**
|
||||
* text to display when `allowCreate` is true.
|
||||
* @default 'Add "{label}"?'
|
||||
*/
|
||||
addLabelText?: string;
|
||||
/**
|
||||
* renders a custom drop-down arrow to be shown in the right-hand side of the select.
|
||||
* @default undefined
|
||||
*/
|
||||
arrowRenderer?: ArrowRendererHandler | null;
|
||||
/**
|
||||
* blurs the input element after a selection has been made. Handy for lowering the keyboard on mobile devices.
|
||||
* @default false
|
||||
*/
|
||||
autoBlur?: boolean;
|
||||
/**
|
||||
* autofocus the component on mount
|
||||
* @deprecated. Use autoFocus instead
|
||||
* @default false
|
||||
*/
|
||||
autofocus?: boolean;
|
||||
/**
|
||||
* autofocus the component on mount
|
||||
* @default false
|
||||
*/
|
||||
autoFocus?: boolean;
|
||||
/**
|
||||
* If enabled, the input will expand as the length of its value increases
|
||||
*/
|
||||
autosize?: boolean;
|
||||
/**
|
||||
* whether pressing backspace removes the last item when there is no input value
|
||||
* @default true
|
||||
*/
|
||||
backspaceRemoves?: boolean;
|
||||
/**
|
||||
* Message to use for screenreaders to press backspace to remove the current item
|
||||
* {label} is replaced with the item label
|
||||
* @default "Press backspace to remove..."
|
||||
*/
|
||||
backspaceToRemoveMessage?: string;
|
||||
/**
|
||||
* CSS className for the outer element
|
||||
*/
|
||||
className?: string;
|
||||
/**
|
||||
* Prefix prepended to element default className if no className is defined
|
||||
*/
|
||||
classNamePrefix?: string;
|
||||
/**
|
||||
* title for the "clear" control when `multi` is true
|
||||
* @default "Clear all"
|
||||
*/
|
||||
clearAllText?: string;
|
||||
/**
|
||||
* Renders a custom clear to be shown in the right-hand side of the select when clearable true
|
||||
* @default undefined
|
||||
*/
|
||||
clearRenderer?: ClearRendererHandler;
|
||||
/**
|
||||
* title for the "clear" control
|
||||
* @default "Clear value"
|
||||
*/
|
||||
clearValueText?: string;
|
||||
/**
|
||||
* whether to close the menu when a value is selected
|
||||
* @default true
|
||||
*/
|
||||
closeOnSelect?: boolean;
|
||||
/**
|
||||
* whether it is possible to reset value. if enabled, an X button will appear at the right side.
|
||||
* @default true
|
||||
*/
|
||||
clearable?: boolean;
|
||||
/**
|
||||
* whether backspace removes an item if there is no text input
|
||||
* @default true
|
||||
*/
|
||||
deleteRemoves?: boolean;
|
||||
/**
|
||||
* delimiter to use to join multiple values
|
||||
* @default ","
|
||||
*/
|
||||
delimiter?: string;
|
||||
/**
|
||||
* whether the Select is disabled or not
|
||||
* @default false
|
||||
*/
|
||||
disabled?: boolean;
|
||||
/**
|
||||
* whether escape clears the value when the menu is closed
|
||||
* @default true
|
||||
*/
|
||||
escapeClearsValue?: boolean;
|
||||
/**
|
||||
* method to filter a single option
|
||||
*/
|
||||
filterOption?: FilterOptionHandler<TValue>;
|
||||
/**
|
||||
* method to filter the options array
|
||||
*/
|
||||
filterOptions?: FilterOptionsHandler<TValue>;
|
||||
/**
|
||||
* id for the underlying HTML input element
|
||||
* @default undefined
|
||||
*/
|
||||
id?: string;
|
||||
/**
|
||||
* whether to strip diacritics when filtering
|
||||
* @default true
|
||||
*/
|
||||
ignoreAccents?: boolean;
|
||||
/**
|
||||
* whether to perform case-insensitive filtering
|
||||
* @default true
|
||||
*/
|
||||
ignoreCase?: boolean;
|
||||
/**
|
||||
* custom attributes for the Input (in the Select-control) e.g: {'data-foo': 'bar'}
|
||||
* @default {}
|
||||
*/
|
||||
inputProps?: { [key: string]: any };
|
||||
/**
|
||||
* renders a custom input
|
||||
*/
|
||||
inputRenderer?: InputRendererHandler;
|
||||
/**
|
||||
* allows for synchronization of component id's on server and client.
|
||||
* @see https://github.com/JedWatson/react-select/pull/1105
|
||||
*/
|
||||
instanceId?: string;
|
||||
/**
|
||||
* whether the Select is loading externally or not (such as options being loaded).
|
||||
* if true, a loading spinner will be shown at the right side.
|
||||
* @default false
|
||||
*/
|
||||
isLoading?: boolean;
|
||||
/**
|
||||
* (legacy mode) joins multiple values into a single form field with the delimiter
|
||||
* @default false
|
||||
*/
|
||||
joinValues?: boolean;
|
||||
/**
|
||||
* the option property to use for the label
|
||||
* @default "label"
|
||||
*/
|
||||
labelKey?: string;
|
||||
/**
|
||||
* (any, start) match the start or entire string when filtering
|
||||
* @default "any"
|
||||
*/
|
||||
matchPos?: string;
|
||||
/**
|
||||
* (any, label, value) which option property to filter on
|
||||
* @default "any"
|
||||
*/
|
||||
matchProp?: string;
|
||||
/**
|
||||
* buffer of px between the base of the dropdown and the viewport to shift if menu doesnt fit in viewport
|
||||
* @default 0
|
||||
*/
|
||||
menuBuffer?: number;
|
||||
/**
|
||||
* optional style to apply to the menu container
|
||||
*/
|
||||
menuContainerStyle?: React.CSSProperties;
|
||||
/**
|
||||
* renders a custom menu with options
|
||||
*/
|
||||
menuRenderer?: MenuRendererHandler<TValue>;
|
||||
/**
|
||||
* optional style to apply to the menu
|
||||
*/
|
||||
menuStyle?: React.CSSProperties;
|
||||
/**
|
||||
* multi-value input
|
||||
* @default false
|
||||
*/
|
||||
multi?: boolean;
|
||||
/**
|
||||
* field name, for hidden `<input>` tag
|
||||
*/
|
||||
name?: string;
|
||||
/**
|
||||
* placeholder displayed when there are no matching search results or a falsy value to hide it
|
||||
* @default "No results found"
|
||||
*/
|
||||
noResultsText?: string | JSX.Element;
|
||||
/**
|
||||
* onBlur handler: function (event) {}
|
||||
*/
|
||||
onBlur?: OnBlurHandler;
|
||||
/**
|
||||
* whether to clear input on blur or not
|
||||
* @default true
|
||||
*/
|
||||
onBlurResetsInput?: boolean;
|
||||
/**
|
||||
* whether the input value should be reset when options are selected.
|
||||
* Also input value will be set to empty if 'onSelectResetsInput=true' and
|
||||
* Select will get new value that not equal previous value.
|
||||
* @default true
|
||||
*/
|
||||
onSelectResetsInput?: boolean;
|
||||
/**
|
||||
* whether to clear input when closing the menu through the arrow
|
||||
* @default true
|
||||
*/
|
||||
onCloseResetsInput?: boolean;
|
||||
/**
|
||||
* onChange handler: function (newValue) {}
|
||||
*/
|
||||
onChange?: OnChangeHandler<TValue>;
|
||||
/**
|
||||
* fires when the menu is closed
|
||||
*/
|
||||
onClose?: OnCloseHandler;
|
||||
/**
|
||||
* onFocus handler: function (event) {}
|
||||
*/
|
||||
onFocus?: OnFocusHandler;
|
||||
/**
|
||||
* onInputChange handler: function (inputValue) {}
|
||||
*/
|
||||
onInputChange?: OnInputChangeHandler;
|
||||
/**
|
||||
* onInputKeyDown handler: function (keyboardEvent) {}
|
||||
*/
|
||||
onInputKeyDown?: OnInputKeyDownHandler;
|
||||
/**
|
||||
* fires when the menu is scrolled to the bottom; can be used to paginate options
|
||||
*/
|
||||
onMenuScrollToBottom?: OnMenuScrollToBottomHandler;
|
||||
/**
|
||||
* fires when the menu is opened
|
||||
*/
|
||||
onOpen?: OnOpenHandler;
|
||||
/**
|
||||
* boolean to enable opening dropdown when focused
|
||||
* @default false
|
||||
*/
|
||||
openOnClick?: boolean;
|
||||
/**
|
||||
* open the options menu when the input gets focus (requires searchable = true)
|
||||
* @default true
|
||||
*/
|
||||
openOnFocus?: boolean;
|
||||
/**
|
||||
* className to add to each option component
|
||||
*/
|
||||
optionClassName?: string;
|
||||
/**
|
||||
* option component to render in dropdown
|
||||
*/
|
||||
optionComponent?: OptionComponentType<TValue>;
|
||||
/**
|
||||
* function which returns a custom way to render the options in the menu
|
||||
*/
|
||||
optionRenderer?: OptionRendererHandler<TValue>;
|
||||
/**
|
||||
* array of Select options
|
||||
* @default false
|
||||
*/
|
||||
options?: Options<TValue>;
|
||||
/**
|
||||
* number of options to jump when using page up/down keys
|
||||
* @default 5
|
||||
*/
|
||||
pageSize?: number;
|
||||
/**
|
||||
* field placeholder, displayed when there's no value
|
||||
* @default "Select..."
|
||||
*/
|
||||
placeholder?: string | JSX.Element;
|
||||
/**
|
||||
* whether the selected option is removed from the dropdown on multi selects
|
||||
* @default true
|
||||
*/
|
||||
removeSelected?: boolean;
|
||||
/**
|
||||
* applies HTML5 required attribute when needed
|
||||
* @default false
|
||||
*/
|
||||
required?: boolean;
|
||||
/**
|
||||
* value to use when you clear the control
|
||||
*/
|
||||
resetValue?: any;
|
||||
/**
|
||||
* use react-select in right-to-left direction
|
||||
* @default false
|
||||
*/
|
||||
rtl?: boolean;
|
||||
/**
|
||||
* whether the viewport will shift to display the entire menu when engaged
|
||||
* @default true
|
||||
*/
|
||||
scrollMenuIntoView?: boolean;
|
||||
/**
|
||||
* whether to enable searching feature or not
|
||||
* @default true;
|
||||
*/
|
||||
searchable?: boolean;
|
||||
/**
|
||||
* whether to select the currently focused value when the [tab] key is pressed
|
||||
*/
|
||||
tabSelectsValue?: boolean;
|
||||
/**
|
||||
* initial field value
|
||||
*/
|
||||
value?: Option<TValue> | Options<TValue> | string | string[] | number | number[] | boolean;
|
||||
/**
|
||||
* the option property to use for the value
|
||||
* @default "value"
|
||||
*/
|
||||
valueKey?: string;
|
||||
/**
|
||||
* function which returns a custom way to render the value selected
|
||||
* @default false
|
||||
*/
|
||||
valueRenderer?: ValueRendererHandler<TValue>;
|
||||
/**
|
||||
* optional style to apply to the control
|
||||
*/
|
||||
style?: React.CSSProperties;
|
||||
|
||||
/**
|
||||
* optional tab index of the control
|
||||
*/
|
||||
tabIndex?: string | number;
|
||||
|
||||
/**
|
||||
* value component to render
|
||||
*/
|
||||
valueComponent?: ValueComponentType<TValue>;
|
||||
|
||||
/**
|
||||
* optional style to apply to the component wrapper
|
||||
*/
|
||||
wrapperStyle?: React.CSSProperties;
|
||||
|
||||
/**
|
||||
* onClick handler for value labels: function (value, event) {}
|
||||
*/
|
||||
onValueClick?: OnValueClickHandler<TValue>;
|
||||
|
||||
/**
|
||||
* pass the value to onChange as a simple value (legacy pre 1.0 mode), defaults to false
|
||||
*/
|
||||
simpleValue?: boolean;
|
||||
}
|
||||
|
||||
@@ -90,13 +90,13 @@ import { JSXInternal } from '..';
|
||||
>JSXInternal : any
|
||||
|
||||
export function jsx(
|
||||
>jsx : { (type: string, props: JSXInternal.HTMLAttributes & JSXInternal.SVGAttributes & Record<string, any> & { children?: ComponentChild;}, key?: string | undefined): VNode<any>; <P>(type: ComponentType<P>, props: P & { children?: ComponentChild; }, key?: string | undefined): VNode<any>; }
|
||||
>jsx : { (type: string, props: JSXInternal.HTMLAttributes & JSXInternal.SVGAttributes & Record<string, any> & { children?: ComponentChild;}, key?: string | undefined): VNode<any>; <P>(type: ComponentType<P>, props: P & { children?: ComponentChild | undefined; }, key?: string | undefined): VNode<any>; }
|
||||
|
||||
type: string,
|
||||
>type : string
|
||||
|
||||
props: JSXInternal.HTMLAttributes &
|
||||
>props : JSXInternal.HTMLAttributes<{}> & JSXInternal.SVGAttributes<{}> & Record<string, any> & { children?: ComponentChild; }
|
||||
>props : JSXInternal.HTMLAttributes<{}> & JSXInternal.SVGAttributes<{}> & Record<string, any> & { children?: ComponentChild | undefined; }
|
||||
>JSXInternal : any
|
||||
|
||||
JSXInternal.SVGAttributes &
|
||||
@@ -110,13 +110,13 @@ export function jsx(
|
||||
|
||||
): VNode<any>;
|
||||
export function jsx<P>(
|
||||
>jsx : { (type: string, props: JSXInternal.HTMLAttributes<{}> & JSXInternal.SVGAttributes<{}> & Record<string, any> & { children?: ComponentChild; }, key?: string | undefined): VNode<any>; <P>(type: ComponentType<P>, props: Attributes & P & { children?: ComponentChild;}, key?: string | undefined): VNode<any>; }
|
||||
>jsx : { (type: string, props: JSXInternal.HTMLAttributes<{}> & JSXInternal.SVGAttributes<{}> & Record<string, any> & { children?: ComponentChild | undefined; }, key?: string | undefined): VNode<any>; <P>(type: ComponentType<P>, props: Attributes & P & { children?: ComponentChild;}, key?: string | undefined): VNode<any>; }
|
||||
|
||||
type: ComponentType<P>,
|
||||
>type : ComponentType<P>
|
||||
|
||||
props: Attributes & P & { children?: ComponentChild },
|
||||
>props : P & { children?: ComponentChild; }
|
||||
>props : P & { children?: ComponentChild | undefined; }
|
||||
>children : ComponentChild | undefined
|
||||
|
||||
key?: string
|
||||
@@ -125,13 +125,13 @@ export function jsx<P>(
|
||||
): VNode<any>;
|
||||
|
||||
export function jsxs(
|
||||
>jsxs : { (type: string, props: JSXInternal.HTMLAttributes & JSXInternal.SVGAttributes & Record<string, any> & { children?: ComponentChild[];}, key?: string | undefined): VNode<any>; <P>(type: ComponentType<P>, props: P & { children?: ComponentChild[]; }, key?: string | undefined): VNode<any>; }
|
||||
>jsxs : { (type: string, props: JSXInternal.HTMLAttributes & JSXInternal.SVGAttributes & Record<string, any> & { children?: ComponentChild[];}, key?: string | undefined): VNode<any>; <P>(type: ComponentType<P>, props: P & { children?: ComponentChild[] | undefined; }, key?: string | undefined): VNode<any>; }
|
||||
|
||||
type: string,
|
||||
>type : string
|
||||
|
||||
props: JSXInternal.HTMLAttributes &
|
||||
>props : JSXInternal.HTMLAttributes<{}> & JSXInternal.SVGAttributes<{}> & Record<string, any> & { children?: ComponentChild[]; }
|
||||
>props : JSXInternal.HTMLAttributes<{}> & JSXInternal.SVGAttributes<{}> & Record<string, any> & { children?: ComponentChild[] | undefined; }
|
||||
>JSXInternal : any
|
||||
|
||||
JSXInternal.SVGAttributes &
|
||||
@@ -145,13 +145,13 @@ export function jsxs(
|
||||
|
||||
): VNode<any>;
|
||||
export function jsxs<P>(
|
||||
>jsxs : { (type: string, props: JSXInternal.HTMLAttributes<{}> & JSXInternal.SVGAttributes<{}> & Record<string, any> & { children?: ComponentChild[]; }, key?: string | undefined): VNode<any>; <P>(type: ComponentType<P>, props: Attributes & P & { children?: ComponentChild[];}, key?: string | undefined): VNode<any>; }
|
||||
>jsxs : { (type: string, props: JSXInternal.HTMLAttributes<{}> & JSXInternal.SVGAttributes<{}> & Record<string, any> & { children?: ComponentChild[] | undefined; }, key?: string | undefined): VNode<any>; <P>(type: ComponentType<P>, props: Attributes & P & { children?: ComponentChild[];}, key?: string | undefined): VNode<any>; }
|
||||
|
||||
type: ComponentType<P>,
|
||||
>type : ComponentType<P>
|
||||
|
||||
props: Attributes & P & { children?: ComponentChild[] },
|
||||
>props : P & { children?: ComponentChild[]; }
|
||||
>props : P & { children?: ComponentChild[] | undefined; }
|
||||
>children : ComponentChild[] | undefined
|
||||
|
||||
key?: string
|
||||
@@ -160,13 +160,13 @@ export function jsxs<P>(
|
||||
): VNode<any>;
|
||||
|
||||
export function jsxDEV(
|
||||
>jsxDEV : { (type: string, props: JSXInternal.HTMLAttributes & JSXInternal.SVGAttributes & Record<string, any> & { children?: ComponentChildren;}, key?: string | undefined): VNode<any>; <P>(type: ComponentType<P>, props: P & { children?: ComponentChildren; }, key?: string | undefined): VNode<any>; }
|
||||
>jsxDEV : { (type: string, props: JSXInternal.HTMLAttributes & JSXInternal.SVGAttributes & Record<string, any> & { children?: ComponentChildren;}, key?: string | undefined): VNode<any>; <P>(type: ComponentType<P>, props: P & { children?: ComponentChildren | undefined; }, key?: string | undefined): VNode<any>; }
|
||||
|
||||
type: string,
|
||||
>type : string
|
||||
|
||||
props: JSXInternal.HTMLAttributes &
|
||||
>props : JSXInternal.HTMLAttributes<{}> & JSXInternal.SVGAttributes<{}> & Record<string, any> & { children?: ComponentChildren; }
|
||||
>props : JSXInternal.HTMLAttributes<{}> & JSXInternal.SVGAttributes<{}> & Record<string, any> & { children?: ComponentChildren | undefined; }
|
||||
>JSXInternal : any
|
||||
|
||||
JSXInternal.SVGAttributes &
|
||||
@@ -180,13 +180,13 @@ export function jsxDEV(
|
||||
|
||||
): VNode<any>;
|
||||
export function jsxDEV<P>(
|
||||
>jsxDEV : { (type: string, props: JSXInternal.HTMLAttributes<{}> & JSXInternal.SVGAttributes<{}> & Record<string, any> & { children?: ComponentChildren; }, key?: string | undefined): VNode<any>; <P>(type: ComponentType<P>, props: Attributes & P & { children?: ComponentChildren;}, key?: string | undefined): VNode<any>; }
|
||||
>jsxDEV : { (type: string, props: JSXInternal.HTMLAttributes<{}> & JSXInternal.SVGAttributes<{}> & Record<string, any> & { children?: ComponentChildren | undefined; }, key?: string | undefined): VNode<any>; <P>(type: ComponentType<P>, props: Attributes & P & { children?: ComponentChildren;}, key?: string | undefined): VNode<any>; }
|
||||
|
||||
type: ComponentType<P>,
|
||||
>type : ComponentType<P>
|
||||
|
||||
props: Attributes & P & { children?: ComponentChildren },
|
||||
>props : P & { children?: ComponentChildren; }
|
||||
>props : P & { children?: ComponentChildren | undefined; }
|
||||
>children : ComponentChildren | undefined
|
||||
|
||||
key?: string
|
||||
|
||||
@@ -90,13 +90,13 @@ import { JSXInternal } from '..';
|
||||
>JSXInternal : any
|
||||
|
||||
export function jsx(
|
||||
>jsx : { (type: string, props: JSXInternal.HTMLAttributes & JSXInternal.SVGAttributes & Record<string, any> & { children?: ComponentChild;}, key?: string | undefined): VNode<any>; <P>(type: ComponentType<P>, props: P & { children?: ComponentChild; }, key?: string | undefined): VNode<any>; }
|
||||
>jsx : { (type: string, props: JSXInternal.HTMLAttributes & JSXInternal.SVGAttributes & Record<string, any> & { children?: ComponentChild;}, key?: string | undefined): VNode<any>; <P>(type: ComponentType<P>, props: P & { children?: ComponentChild | undefined; }, key?: string | undefined): VNode<any>; }
|
||||
|
||||
type: string,
|
||||
>type : string
|
||||
|
||||
props: JSXInternal.HTMLAttributes &
|
||||
>props : JSXInternal.HTMLAttributes<{}> & JSXInternal.SVGAttributes<{}> & Record<string, any> & { children?: ComponentChild; }
|
||||
>props : JSXInternal.HTMLAttributes<{}> & JSXInternal.SVGAttributes<{}> & Record<string, any> & { children?: ComponentChild | undefined; }
|
||||
>JSXInternal : any
|
||||
|
||||
JSXInternal.SVGAttributes &
|
||||
@@ -110,13 +110,13 @@ export function jsx(
|
||||
|
||||
): VNode<any>;
|
||||
export function jsx<P>(
|
||||
>jsx : { (type: string, props: JSXInternal.HTMLAttributes<{}> & JSXInternal.SVGAttributes<{}> & Record<string, any> & { children?: ComponentChild; }, key?: string | undefined): VNode<any>; <P>(type: ComponentType<P>, props: Attributes & P & { children?: ComponentChild;}, key?: string | undefined): VNode<any>; }
|
||||
>jsx : { (type: string, props: JSXInternal.HTMLAttributes<{}> & JSXInternal.SVGAttributes<{}> & Record<string, any> & { children?: ComponentChild | undefined; }, key?: string | undefined): VNode<any>; <P>(type: ComponentType<P>, props: Attributes & P & { children?: ComponentChild;}, key?: string | undefined): VNode<any>; }
|
||||
|
||||
type: ComponentType<P>,
|
||||
>type : ComponentType<P>
|
||||
|
||||
props: Attributes & P & { children?: ComponentChild },
|
||||
>props : P & { children?: ComponentChild; }
|
||||
>props : P & { children?: ComponentChild | undefined; }
|
||||
>children : ComponentChild | undefined
|
||||
|
||||
key?: string
|
||||
@@ -125,13 +125,13 @@ export function jsx<P>(
|
||||
): VNode<any>;
|
||||
|
||||
export function jsxs(
|
||||
>jsxs : { (type: string, props: JSXInternal.HTMLAttributes & JSXInternal.SVGAttributes & Record<string, any> & { children?: ComponentChild[];}, key?: string | undefined): VNode<any>; <P>(type: ComponentType<P>, props: P & { children?: ComponentChild[]; }, key?: string | undefined): VNode<any>; }
|
||||
>jsxs : { (type: string, props: JSXInternal.HTMLAttributes & JSXInternal.SVGAttributes & Record<string, any> & { children?: ComponentChild[];}, key?: string | undefined): VNode<any>; <P>(type: ComponentType<P>, props: P & { children?: ComponentChild[] | undefined; }, key?: string | undefined): VNode<any>; }
|
||||
|
||||
type: string,
|
||||
>type : string
|
||||
|
||||
props: JSXInternal.HTMLAttributes &
|
||||
>props : JSXInternal.HTMLAttributes<{}> & JSXInternal.SVGAttributes<{}> & Record<string, any> & { children?: ComponentChild[]; }
|
||||
>props : JSXInternal.HTMLAttributes<{}> & JSXInternal.SVGAttributes<{}> & Record<string, any> & { children?: ComponentChild[] | undefined; }
|
||||
>JSXInternal : any
|
||||
|
||||
JSXInternal.SVGAttributes &
|
||||
@@ -145,13 +145,13 @@ export function jsxs(
|
||||
|
||||
): VNode<any>;
|
||||
export function jsxs<P>(
|
||||
>jsxs : { (type: string, props: JSXInternal.HTMLAttributes<{}> & JSXInternal.SVGAttributes<{}> & Record<string, any> & { children?: ComponentChild[]; }, key?: string | undefined): VNode<any>; <P>(type: ComponentType<P>, props: Attributes & P & { children?: ComponentChild[];}, key?: string | undefined): VNode<any>; }
|
||||
>jsxs : { (type: string, props: JSXInternal.HTMLAttributes<{}> & JSXInternal.SVGAttributes<{}> & Record<string, any> & { children?: ComponentChild[] | undefined; }, key?: string | undefined): VNode<any>; <P>(type: ComponentType<P>, props: Attributes & P & { children?: ComponentChild[];}, key?: string | undefined): VNode<any>; }
|
||||
|
||||
type: ComponentType<P>,
|
||||
>type : ComponentType<P>
|
||||
|
||||
props: Attributes & P & { children?: ComponentChild[] },
|
||||
>props : P & { children?: ComponentChild[]; }
|
||||
>props : P & { children?: ComponentChild[] | undefined; }
|
||||
>children : ComponentChild[] | undefined
|
||||
|
||||
key?: string
|
||||
@@ -160,13 +160,13 @@ export function jsxs<P>(
|
||||
): VNode<any>;
|
||||
|
||||
export function jsxDEV(
|
||||
>jsxDEV : { (type: string, props: JSXInternal.HTMLAttributes & JSXInternal.SVGAttributes & Record<string, any> & { children?: ComponentChildren;}, key?: string | undefined): VNode<any>; <P>(type: ComponentType<P>, props: P & { children?: ComponentChildren; }, key?: string | undefined): VNode<any>; }
|
||||
>jsxDEV : { (type: string, props: JSXInternal.HTMLAttributes & JSXInternal.SVGAttributes & Record<string, any> & { children?: ComponentChildren;}, key?: string | undefined): VNode<any>; <P>(type: ComponentType<P>, props: P & { children?: ComponentChildren | undefined; }, key?: string | undefined): VNode<any>; }
|
||||
|
||||
type: string,
|
||||
>type : string
|
||||
|
||||
props: JSXInternal.HTMLAttributes &
|
||||
>props : JSXInternal.HTMLAttributes<{}> & JSXInternal.SVGAttributes<{}> & Record<string, any> & { children?: ComponentChildren; }
|
||||
>props : JSXInternal.HTMLAttributes<{}> & JSXInternal.SVGAttributes<{}> & Record<string, any> & { children?: ComponentChildren | undefined; }
|
||||
>JSXInternal : any
|
||||
|
||||
JSXInternal.SVGAttributes &
|
||||
@@ -180,13 +180,13 @@ export function jsxDEV(
|
||||
|
||||
): VNode<any>;
|
||||
export function jsxDEV<P>(
|
||||
>jsxDEV : { (type: string, props: JSXInternal.HTMLAttributes<{}> & JSXInternal.SVGAttributes<{}> & Record<string, any> & { children?: ComponentChildren; }, key?: string | undefined): VNode<any>; <P>(type: ComponentType<P>, props: Attributes & P & { children?: ComponentChildren;}, key?: string | undefined): VNode<any>; }
|
||||
>jsxDEV : { (type: string, props: JSXInternal.HTMLAttributes<{}> & JSXInternal.SVGAttributes<{}> & Record<string, any> & { children?: ComponentChildren | undefined; }, key?: string | undefined): VNode<any>; <P>(type: ComponentType<P>, props: Attributes & P & { children?: ComponentChildren;}, key?: string | undefined): VNode<any>; }
|
||||
|
||||
type: ComponentType<P>,
|
||||
>type : ComponentType<P>
|
||||
|
||||
props: Attributes & P & { children?: ComponentChildren },
|
||||
>props : P & { children?: ComponentChildren; }
|
||||
>props : P & { children?: ComponentChildren | undefined; }
|
||||
>children : ComponentChildren | undefined
|
||||
|
||||
key?: string
|
||||
|
||||
@@ -90,13 +90,13 @@ import { JSXInternal } from '..';
|
||||
>JSXInternal : any
|
||||
|
||||
export function jsx(
|
||||
>jsx : { (type: string, props: JSXInternal.HTMLAttributes & JSXInternal.SVGAttributes & Record<string, any> & { children?: ComponentChild;}, key?: string | undefined): VNode<any>; <P>(type: ComponentType<P>, props: P & { children?: ComponentChild; }, key?: string | undefined): VNode<any>; }
|
||||
>jsx : { (type: string, props: JSXInternal.HTMLAttributes & JSXInternal.SVGAttributes & Record<string, any> & { children?: ComponentChild;}, key?: string | undefined): VNode<any>; <P>(type: ComponentType<P>, props: P & { children?: ComponentChild | undefined; }, key?: string | undefined): VNode<any>; }
|
||||
|
||||
type: string,
|
||||
>type : string
|
||||
|
||||
props: JSXInternal.HTMLAttributes &
|
||||
>props : JSXInternal.HTMLAttributes<{}> & JSXInternal.SVGAttributes<{}> & Record<string, any> & { children?: ComponentChild; }
|
||||
>props : JSXInternal.HTMLAttributes<{}> & JSXInternal.SVGAttributes<{}> & Record<string, any> & { children?: ComponentChild | undefined; }
|
||||
>JSXInternal : any
|
||||
|
||||
JSXInternal.SVGAttributes &
|
||||
@@ -110,13 +110,13 @@ export function jsx(
|
||||
|
||||
): VNode<any>;
|
||||
export function jsx<P>(
|
||||
>jsx : { (type: string, props: JSXInternal.HTMLAttributes<{}> & JSXInternal.SVGAttributes<{}> & Record<string, any> & { children?: ComponentChild; }, key?: string | undefined): VNode<any>; <P>(type: ComponentType<P>, props: Attributes & P & { children?: ComponentChild;}, key?: string | undefined): VNode<any>; }
|
||||
>jsx : { (type: string, props: JSXInternal.HTMLAttributes<{}> & JSXInternal.SVGAttributes<{}> & Record<string, any> & { children?: ComponentChild | undefined; }, key?: string | undefined): VNode<any>; <P>(type: ComponentType<P>, props: Attributes & P & { children?: ComponentChild;}, key?: string | undefined): VNode<any>; }
|
||||
|
||||
type: ComponentType<P>,
|
||||
>type : ComponentType<P>
|
||||
|
||||
props: Attributes & P & { children?: ComponentChild },
|
||||
>props : P & { children?: ComponentChild; }
|
||||
>props : P & { children?: ComponentChild | undefined; }
|
||||
>children : ComponentChild | undefined
|
||||
|
||||
key?: string
|
||||
@@ -126,13 +126,13 @@ export function jsx<P>(
|
||||
|
||||
|
||||
export function jsxs(
|
||||
>jsxs : { (type: string, props: JSXInternal.HTMLAttributes & JSXInternal.SVGAttributes & Record<string, any> & { children?: ComponentChild[];}, key?: string | undefined): VNode<any>; <P>(type: ComponentType<P>, props: P & { children?: ComponentChild[]; }, key?: string | undefined): VNode<any>; }
|
||||
>jsxs : { (type: string, props: JSXInternal.HTMLAttributes & JSXInternal.SVGAttributes & Record<string, any> & { children?: ComponentChild[];}, key?: string | undefined): VNode<any>; <P>(type: ComponentType<P>, props: P & { children?: ComponentChild[] | undefined; }, key?: string | undefined): VNode<any>; }
|
||||
|
||||
type: string,
|
||||
>type : string
|
||||
|
||||
props: JSXInternal.HTMLAttributes &
|
||||
>props : JSXInternal.HTMLAttributes<{}> & JSXInternal.SVGAttributes<{}> & Record<string, any> & { children?: ComponentChild[]; }
|
||||
>props : JSXInternal.HTMLAttributes<{}> & JSXInternal.SVGAttributes<{}> & Record<string, any> & { children?: ComponentChild[] | undefined; }
|
||||
>JSXInternal : any
|
||||
|
||||
JSXInternal.SVGAttributes &
|
||||
@@ -146,13 +146,13 @@ export function jsxs(
|
||||
|
||||
): VNode<any>;
|
||||
export function jsxs<P>(
|
||||
>jsxs : { (type: string, props: JSXInternal.HTMLAttributes<{}> & JSXInternal.SVGAttributes<{}> & Record<string, any> & { children?: ComponentChild[]; }, key?: string | undefined): VNode<any>; <P>(type: ComponentType<P>, props: Attributes & P & { children?: ComponentChild[];}, key?: string | undefined): VNode<any>; }
|
||||
>jsxs : { (type: string, props: JSXInternal.HTMLAttributes<{}> & JSXInternal.SVGAttributes<{}> & Record<string, any> & { children?: ComponentChild[] | undefined; }, key?: string | undefined): VNode<any>; <P>(type: ComponentType<P>, props: Attributes & P & { children?: ComponentChild[];}, key?: string | undefined): VNode<any>; }
|
||||
|
||||
type: ComponentType<P>,
|
||||
>type : ComponentType<P>
|
||||
|
||||
props: Attributes & P & { children?: ComponentChild[] },
|
||||
>props : P & { children?: ComponentChild[]; }
|
||||
>props : P & { children?: ComponentChild[] | undefined; }
|
||||
>children : ComponentChild[] | undefined
|
||||
|
||||
key?: string
|
||||
@@ -162,13 +162,13 @@ export function jsxs<P>(
|
||||
|
||||
|
||||
export function jsxDEV(
|
||||
>jsxDEV : { (type: string, props: JSXInternal.HTMLAttributes & JSXInternal.SVGAttributes & Record<string, any> & { children?: ComponentChildren;}, key?: string | undefined): VNode<any>; <P>(type: ComponentType<P>, props: P & { children?: ComponentChildren; }, key?: string | undefined): VNode<any>; }
|
||||
>jsxDEV : { (type: string, props: JSXInternal.HTMLAttributes & JSXInternal.SVGAttributes & Record<string, any> & { children?: ComponentChildren;}, key?: string | undefined): VNode<any>; <P>(type: ComponentType<P>, props: P & { children?: ComponentChildren | undefined; }, key?: string | undefined): VNode<any>; }
|
||||
|
||||
type: string,
|
||||
>type : string
|
||||
|
||||
props: JSXInternal.HTMLAttributes &
|
||||
>props : JSXInternal.HTMLAttributes<{}> & JSXInternal.SVGAttributes<{}> & Record<string, any> & { children?: ComponentChildren; }
|
||||
>props : JSXInternal.HTMLAttributes<{}> & JSXInternal.SVGAttributes<{}> & Record<string, any> & { children?: ComponentChildren | undefined; }
|
||||
>JSXInternal : any
|
||||
|
||||
JSXInternal.SVGAttributes &
|
||||
@@ -182,13 +182,13 @@ export function jsxDEV(
|
||||
|
||||
): VNode<any>;
|
||||
export function jsxDEV<P>(
|
||||
>jsxDEV : { (type: string, props: JSXInternal.HTMLAttributes<{}> & JSXInternal.SVGAttributes<{}> & Record<string, any> & { children?: ComponentChildren; }, key?: string | undefined): VNode<any>; <P>(type: ComponentType<P>, props: Attributes & P & { children?: ComponentChildren;}, key?: string | undefined): VNode<any>; }
|
||||
>jsxDEV : { (type: string, props: JSXInternal.HTMLAttributes<{}> & JSXInternal.SVGAttributes<{}> & Record<string, any> & { children?: ComponentChildren | undefined; }, key?: string | undefined): VNode<any>; <P>(type: ComponentType<P>, props: Attributes & P & { children?: ComponentChildren;}, key?: string | undefined): VNode<any>; }
|
||||
|
||||
type: ComponentType<P>,
|
||||
>type : ComponentType<P>
|
||||
|
||||
props: Attributes & P & { children?: ComponentChildren },
|
||||
>props : P & { children?: ComponentChildren; }
|
||||
>props : P & { children?: ComponentChildren | undefined; }
|
||||
>children : ComponentChildren | undefined
|
||||
|
||||
key?: string
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
=== tests/cases/conformance/es2021/logicalAssignment/logicalAssignment8.ts ===
|
||||
declare const bar: { value?: number[] } | undefined
|
||||
>bar : { value?: number[]; } | undefined
|
||||
>bar : { value?: number[] | undefined; } | undefined
|
||||
>value : number[] | undefined
|
||||
|
||||
function foo1(results: number[] | undefined) {
|
||||
@@ -15,7 +15,7 @@ function foo1(results: number[] | undefined) {
|
||||
>results : number[] | undefined
|
||||
>bar?.value ?? [] : number[]
|
||||
>bar?.value : number[] | undefined
|
||||
>bar : { value?: number[]; } | undefined
|
||||
>bar : { value?: number[] | undefined; } | undefined
|
||||
>value : number[] | undefined
|
||||
>[] : never[]
|
||||
>push : (...items: number[]) => number
|
||||
@@ -34,7 +34,7 @@ function foo2(results: number[] | undefined) {
|
||||
>results : number[] | undefined
|
||||
>bar?.value ?? [] : number[]
|
||||
>bar?.value : number[] | undefined
|
||||
>bar : { value?: number[]; } | undefined
|
||||
>bar : { value?: number[] | undefined; } | undefined
|
||||
>value : number[] | undefined
|
||||
>[] : never[]
|
||||
>push : (...items: number[]) => number
|
||||
@@ -53,7 +53,7 @@ function foo3(results: number[] | undefined) {
|
||||
>results : number[] | undefined
|
||||
>bar?.value ?? [] : number[]
|
||||
>bar?.value : number[] | undefined
|
||||
>bar : { value?: number[]; } | undefined
|
||||
>bar : { value?: number[] | undefined; } | undefined
|
||||
>value : number[] | undefined
|
||||
>[] : never[]
|
||||
>push : (...items: number[]) => number
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
=== tests/cases/conformance/es2021/logicalAssignment/logicalAssignment8.ts ===
|
||||
declare const bar: { value?: number[] } | undefined
|
||||
>bar : { value?: number[]; } | undefined
|
||||
>bar : { value?: number[] | undefined; } | undefined
|
||||
>value : number[] | undefined
|
||||
|
||||
function foo1(results: number[] | undefined) {
|
||||
@@ -15,7 +15,7 @@ function foo1(results: number[] | undefined) {
|
||||
>results : number[] | undefined
|
||||
>bar?.value ?? [] : number[]
|
||||
>bar?.value : number[] | undefined
|
||||
>bar : { value?: number[]; } | undefined
|
||||
>bar : { value?: number[] | undefined; } | undefined
|
||||
>value : number[] | undefined
|
||||
>[] : never[]
|
||||
>push : (...items: number[]) => number
|
||||
@@ -34,7 +34,7 @@ function foo2(results: number[] | undefined) {
|
||||
>results : number[] | undefined
|
||||
>bar?.value ?? [] : number[]
|
||||
>bar?.value : number[] | undefined
|
||||
>bar : { value?: number[]; } | undefined
|
||||
>bar : { value?: number[] | undefined; } | undefined
|
||||
>value : number[] | undefined
|
||||
>[] : never[]
|
||||
>push : (...items: number[]) => number
|
||||
@@ -53,7 +53,7 @@ function foo3(results: number[] | undefined) {
|
||||
>results : number[] | undefined
|
||||
>bar?.value ?? [] : number[]
|
||||
>bar?.value : number[] | undefined
|
||||
>bar : { value?: number[]; } | undefined
|
||||
>bar : { value?: number[] | undefined; } | undefined
|
||||
>value : number[] | undefined
|
||||
>[] : never[]
|
||||
>push : (...items: number[]) => number
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
=== tests/cases/conformance/es2021/logicalAssignment/logicalAssignment8.ts ===
|
||||
declare const bar: { value?: number[] } | undefined
|
||||
>bar : { value?: number[]; } | undefined
|
||||
>bar : { value?: number[] | undefined; } | undefined
|
||||
>value : number[] | undefined
|
||||
|
||||
function foo1(results: number[] | undefined) {
|
||||
@@ -15,7 +15,7 @@ function foo1(results: number[] | undefined) {
|
||||
>results : number[] | undefined
|
||||
>bar?.value ?? [] : number[]
|
||||
>bar?.value : number[] | undefined
|
||||
>bar : { value?: number[]; } | undefined
|
||||
>bar : { value?: number[] | undefined; } | undefined
|
||||
>value : number[] | undefined
|
||||
>[] : never[]
|
||||
>push : (...items: number[]) => number
|
||||
@@ -34,7 +34,7 @@ function foo2(results: number[] | undefined) {
|
||||
>results : number[] | undefined
|
||||
>bar?.value ?? [] : number[]
|
||||
>bar?.value : number[] | undefined
|
||||
>bar : { value?: number[]; } | undefined
|
||||
>bar : { value?: number[] | undefined; } | undefined
|
||||
>value : number[] | undefined
|
||||
>[] : never[]
|
||||
>push : (...items: number[]) => number
|
||||
@@ -53,7 +53,7 @@ function foo3(results: number[] | undefined) {
|
||||
>results : number[] | undefined
|
||||
>bar?.value ?? [] : number[]
|
||||
>bar?.value : number[] | undefined
|
||||
>bar : { value?: number[]; } | undefined
|
||||
>bar : { value?: number[] | undefined; } | undefined
|
||||
>value : number[] | undefined
|
||||
>[] : never[]
|
||||
>push : (...items: number[]) => number
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
=== tests/cases/conformance/es2021/logicalAssignment/logicalAssignment8.ts ===
|
||||
declare const bar: { value?: number[] } | undefined
|
||||
>bar : { value?: number[]; } | undefined
|
||||
>bar : { value?: number[] | undefined; } | undefined
|
||||
>value : number[] | undefined
|
||||
|
||||
function foo1(results: number[] | undefined) {
|
||||
@@ -15,7 +15,7 @@ function foo1(results: number[] | undefined) {
|
||||
>results : number[] | undefined
|
||||
>bar?.value ?? [] : number[]
|
||||
>bar?.value : number[] | undefined
|
||||
>bar : { value?: number[]; } | undefined
|
||||
>bar : { value?: number[] | undefined; } | undefined
|
||||
>value : number[] | undefined
|
||||
>[] : never[]
|
||||
>push : (...items: number[]) => number
|
||||
@@ -34,7 +34,7 @@ function foo2(results: number[] | undefined) {
|
||||
>results : number[] | undefined
|
||||
>bar?.value ?? [] : number[]
|
||||
>bar?.value : number[] | undefined
|
||||
>bar : { value?: number[]; } | undefined
|
||||
>bar : { value?: number[] | undefined; } | undefined
|
||||
>value : number[] | undefined
|
||||
>[] : never[]
|
||||
>push : (...items: number[]) => number
|
||||
@@ -53,7 +53,7 @@ function foo3(results: number[] | undefined) {
|
||||
>results : number[] | undefined
|
||||
>bar?.value ?? [] : number[]
|
||||
>bar?.value : number[] | undefined
|
||||
>bar : { value?: number[]; } | undefined
|
||||
>bar : { value?: number[] | undefined; } | undefined
|
||||
>value : number[] | undefined
|
||||
>[] : never[]
|
||||
>push : (...items: number[]) => number
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
=== tests/cases/conformance/es2021/logicalAssignment/logicalAssignment9.ts ===
|
||||
declare let x: { a?: boolean };
|
||||
>x : { a?: boolean; }
|
||||
>x : { a?: boolean | undefined; }
|
||||
>a : boolean | undefined
|
||||
|
||||
x.a ??= true;
|
||||
>x.a ??= true : boolean
|
||||
>x.a : boolean
|
||||
>x : { a?: boolean; }
|
||||
>a : boolean
|
||||
>x.a : boolean | undefined
|
||||
>x : { a?: boolean | undefined; }
|
||||
>a : boolean | undefined
|
||||
>true : true
|
||||
|
||||
x.a &&= false;
|
||||
>x.a &&= false : false
|
||||
>x.a : boolean
|
||||
>x : { a?: boolean; }
|
||||
>a : boolean
|
||||
>x.a &&= false : false | undefined
|
||||
>x.a : boolean | undefined
|
||||
>x : { a?: boolean | undefined; }
|
||||
>a : boolean | undefined
|
||||
>false : false
|
||||
|
||||
|
||||
@@ -178,15 +178,15 @@ declare let y12: {
|
||||
};
|
||||
declare function nonpartial<T>(x: Partial<T>): T;
|
||||
declare let x20: [number | undefined, string?, ...boolean[]];
|
||||
declare let y20: [number | undefined, string, ...boolean[]];
|
||||
declare let y20: [number, string, ...boolean[]];
|
||||
declare let x21: (number | undefined)[];
|
||||
declare let y21: (number | undefined)[];
|
||||
declare let y21: number[];
|
||||
declare let x22: {
|
||||
a: number | undefined;
|
||||
b?: string[];
|
||||
};
|
||||
declare let y22: {
|
||||
a: number | undefined;
|
||||
a: number;
|
||||
b: string[];
|
||||
};
|
||||
declare type Awaited<T> = T extends PromiseLike<infer U> ? U : T;
|
||||
|
||||
@@ -10,7 +10,7 @@ type T00 = Boxified<[number, string?, ...boolean[]]>;
|
||||
>T00 : [Box<number>, Box<string | undefined>?, ...Box<boolean>[]]
|
||||
|
||||
type T01 = Partial<[number, string?, ...boolean[]]>;
|
||||
>T01 : [number?, string?, ...(boolean | undefined)[]]
|
||||
>T01 : [(number | undefined)?, (string | undefined)?, ...(boolean | undefined)[]]
|
||||
|
||||
type T02 = Required<[number, string?, ...boolean[]]>;
|
||||
>T02 : [number, string, ...boolean[]]
|
||||
@@ -124,33 +124,33 @@ declare function nonpartial<T>(x: Partial<T>): T;
|
||||
>x : Partial<T>
|
||||
|
||||
declare let x20: [number | undefined, string?, ...boolean[]];
|
||||
>x20 : [number | undefined, string?, ...boolean[]]
|
||||
>x20 : [number | undefined, (string | undefined)?, ...boolean[]]
|
||||
|
||||
let y20 = nonpartial(x20);
|
||||
>y20 : [number | undefined, string, ...boolean[]]
|
||||
>nonpartial(x20) : [number | undefined, string, ...boolean[]]
|
||||
>y20 : [number, string, ...boolean[]]
|
||||
>nonpartial(x20) : [number, string, ...boolean[]]
|
||||
>nonpartial : <T>(x: Partial<T>) => T
|
||||
>x20 : [number | undefined, string?, ...boolean[]]
|
||||
>x20 : [number | undefined, (string | undefined)?, ...boolean[]]
|
||||
|
||||
declare let x21: (number | undefined)[];
|
||||
>x21 : (number | undefined)[]
|
||||
|
||||
let y21 = nonpartial(x21);
|
||||
>y21 : (number | undefined)[]
|
||||
>nonpartial(x21) : (number | undefined)[]
|
||||
>y21 : number[]
|
||||
>nonpartial(x21) : number[]
|
||||
>nonpartial : <T>(x: Partial<T>) => T
|
||||
>x21 : (number | undefined)[]
|
||||
|
||||
declare let x22: { a: number | undefined, b?: string[] };
|
||||
>x22 : { a: number | undefined; b?: string[]; }
|
||||
>x22 : { a: number | undefined; b?: string[] | undefined; }
|
||||
>a : number | undefined
|
||||
>b : string[] | undefined
|
||||
|
||||
let y22 = nonpartial(x22);
|
||||
>y22 : { a: number | undefined; b: string[]; }
|
||||
>nonpartial(x22) : { a: number | undefined; b: string[]; }
|
||||
>y22 : { a: number; b: string[]; }
|
||||
>nonpartial(x22) : { a: number; b: string[]; }
|
||||
>nonpartial : <T>(x: Partial<T>) => T
|
||||
>x22 : { a: number | undefined; b?: string[]; }
|
||||
>x22 : { a: number | undefined; b?: string[] | undefined; }
|
||||
|
||||
type Awaited<T> = T extends PromiseLike<infer U> ? U : T;
|
||||
>Awaited : Awaited<T>
|
||||
|
||||
@@ -56,10 +56,10 @@ function init(properties: IProperties) {
|
||||
|
||||
interface DeepOptional {
|
||||
a?: {
|
||||
>a : { b?: { c?: string;}; } | undefined
|
||||
>a : { b?: { c?: string | undefined; } | undefined; } | undefined
|
||||
|
||||
b?: {
|
||||
>b : { c?: string; } | undefined
|
||||
>b : { c?: string | undefined; } | undefined
|
||||
|
||||
c?: string
|
||||
>c : string | undefined
|
||||
@@ -72,32 +72,32 @@ function init2(foo: DeepOptional) {
|
||||
>foo : DeepOptional
|
||||
|
||||
if (foo.a) {
|
||||
>foo.a : { b?: { c?: string; }; } | undefined
|
||||
>foo.a : { b?: { c?: string | undefined; } | undefined; } | undefined
|
||||
>foo : DeepOptional
|
||||
>a : { b?: { c?: string; }; } | undefined
|
||||
>a : { b?: { c?: string | undefined; } | undefined; } | undefined
|
||||
|
||||
type A = typeof foo.a;
|
||||
>A : { b?: { c?: string; }; }
|
||||
>foo.a : { b?: { c?: string; }; }
|
||||
>A : { b?: { c?: string | undefined; } | undefined; }
|
||||
>foo.a : { b?: { c?: string | undefined; } | undefined; }
|
||||
>foo : DeepOptional
|
||||
>a : { b?: { c?: string; }; }
|
||||
>a : { b?: { c?: string | undefined; } | undefined; }
|
||||
|
||||
type B = typeof foo.a.b;
|
||||
>B : { c?: string; } | undefined
|
||||
>foo.a.b : { c?: string; } | undefined
|
||||
>foo.a : { b?: { c?: string; }; }
|
||||
>B : { c?: string | undefined; } | undefined
|
||||
>foo.a.b : { c?: string | undefined; } | undefined
|
||||
>foo.a : { b?: { c?: string | undefined; } | undefined; }
|
||||
>foo : DeepOptional
|
||||
>a : { b?: { c?: string; }; }
|
||||
>b : { c?: string; } | undefined
|
||||
>a : { b?: { c?: string | undefined; } | undefined; }
|
||||
>b : { c?: string | undefined; } | undefined
|
||||
|
||||
type C = typeof foo.a.b.c;
|
||||
>C : string | undefined
|
||||
>foo.a.b.c : string | undefined
|
||||
>foo.a.b : { c?: string; } | undefined
|
||||
>foo.a : { b?: { c?: string; }; }
|
||||
>foo.a.b : { c?: string | undefined; } | undefined
|
||||
>foo.a : { b?: { c?: string | undefined; } | undefined; }
|
||||
>foo : DeepOptional
|
||||
>a : { b?: { c?: string; }; }
|
||||
>b : { c?: string; } | undefined
|
||||
>a : { b?: { c?: string | undefined; } | undefined; }
|
||||
>b : { c?: string | undefined; } | undefined
|
||||
>c : string | undefined
|
||||
|
||||
for(const _ of [1]) {
|
||||
@@ -106,58 +106,58 @@ function init2(foo: DeepOptional) {
|
||||
>1 : 1
|
||||
|
||||
type A = typeof foo.a;
|
||||
>A : { b?: { c?: string; }; }
|
||||
>foo.a : { b?: { c?: string; }; }
|
||||
>A : { b?: { c?: string | undefined; } | undefined; }
|
||||
>foo.a : { b?: { c?: string | undefined; } | undefined; }
|
||||
>foo : DeepOptional
|
||||
>a : { b?: { c?: string; }; }
|
||||
>a : { b?: { c?: string | undefined; } | undefined; }
|
||||
|
||||
type B = typeof foo.a.b;
|
||||
>B : { c?: string; } | undefined
|
||||
>foo.a.b : { c?: string; } | undefined
|
||||
>foo.a : { b?: { c?: string; }; }
|
||||
>B : { c?: string | undefined; } | undefined
|
||||
>foo.a.b : { c?: string | undefined; } | undefined
|
||||
>foo.a : { b?: { c?: string | undefined; } | undefined; }
|
||||
>foo : DeepOptional
|
||||
>a : { b?: { c?: string; }; }
|
||||
>b : { c?: string; } | undefined
|
||||
>a : { b?: { c?: string | undefined; } | undefined; }
|
||||
>b : { c?: string | undefined; } | undefined
|
||||
|
||||
type C = typeof foo.a.b.c;
|
||||
>C : string | undefined
|
||||
>foo.a.b.c : string | undefined
|
||||
>foo.a.b : { c?: string; } | undefined
|
||||
>foo.a : { b?: { c?: string; }; }
|
||||
>foo.a.b : { c?: string | undefined; } | undefined
|
||||
>foo.a : { b?: { c?: string | undefined; } | undefined; }
|
||||
>foo : DeepOptional
|
||||
>a : { b?: { c?: string; }; }
|
||||
>b : { c?: string; } | undefined
|
||||
>a : { b?: { c?: string | undefined; } | undefined; }
|
||||
>b : { c?: string | undefined; } | undefined
|
||||
>c : string | undefined
|
||||
|
||||
if (foo.a.b) {
|
||||
>foo.a.b : { c?: string; } | undefined
|
||||
>foo.a : { b?: { c?: string; }; }
|
||||
>foo.a.b : { c?: string | undefined; } | undefined
|
||||
>foo.a : { b?: { c?: string | undefined; } | undefined; }
|
||||
>foo : DeepOptional
|
||||
>a : { b?: { c?: string; }; }
|
||||
>b : { c?: string; } | undefined
|
||||
>a : { b?: { c?: string | undefined; } | undefined; }
|
||||
>b : { c?: string | undefined; } | undefined
|
||||
|
||||
type A = typeof foo.a;
|
||||
>A : { b?: { c?: string; }; }
|
||||
>foo.a : { b?: { c?: string; }; }
|
||||
>A : { b?: { c?: string | undefined; } | undefined; }
|
||||
>foo.a : { b?: { c?: string | undefined; } | undefined; }
|
||||
>foo : DeepOptional
|
||||
>a : { b?: { c?: string; }; }
|
||||
>a : { b?: { c?: string | undefined; } | undefined; }
|
||||
|
||||
type B = typeof foo.a.b;
|
||||
>B : { c?: string; }
|
||||
>foo.a.b : { c?: string; }
|
||||
>foo.a : { b?: { c?: string; }; }
|
||||
>B : { c?: string | undefined; }
|
||||
>foo.a.b : { c?: string | undefined; }
|
||||
>foo.a : { b?: { c?: string | undefined; } | undefined; }
|
||||
>foo : DeepOptional
|
||||
>a : { b?: { c?: string; }; }
|
||||
>b : { c?: string; }
|
||||
>a : { b?: { c?: string | undefined; } | undefined; }
|
||||
>b : { c?: string | undefined; }
|
||||
|
||||
type C = typeof foo.a.b.c;
|
||||
>C : string | undefined
|
||||
>foo.a.b.c : string | undefined
|
||||
>foo.a.b : { c?: string; }
|
||||
>foo.a : { b?: { c?: string; }; }
|
||||
>foo.a.b : { c?: string | undefined; }
|
||||
>foo.a : { b?: { c?: string | undefined; } | undefined; }
|
||||
>foo : DeepOptional
|
||||
>a : { b?: { c?: string; }; }
|
||||
>b : { c?: string; }
|
||||
>a : { b?: { c?: string | undefined; } | undefined; }
|
||||
>b : { c?: string | undefined; }
|
||||
>c : string | undefined
|
||||
|
||||
for(const _ of [1]) {
|
||||
@@ -166,60 +166,60 @@ function init2(foo: DeepOptional) {
|
||||
>1 : 1
|
||||
|
||||
type A = typeof foo.a;
|
||||
>A : { b?: { c?: string; }; }
|
||||
>foo.a : { b?: { c?: string; }; }
|
||||
>A : { b?: { c?: string | undefined; } | undefined; }
|
||||
>foo.a : { b?: { c?: string | undefined; } | undefined; }
|
||||
>foo : DeepOptional
|
||||
>a : { b?: { c?: string; }; }
|
||||
>a : { b?: { c?: string | undefined; } | undefined; }
|
||||
|
||||
type B = typeof foo.a.b;
|
||||
>B : { c?: string; }
|
||||
>foo.a.b : { c?: string; }
|
||||
>foo.a : { b?: { c?: string; }; }
|
||||
>B : { c?: string | undefined; }
|
||||
>foo.a.b : { c?: string | undefined; }
|
||||
>foo.a : { b?: { c?: string | undefined; } | undefined; }
|
||||
>foo : DeepOptional
|
||||
>a : { b?: { c?: string; }; }
|
||||
>b : { c?: string; }
|
||||
>a : { b?: { c?: string | undefined; } | undefined; }
|
||||
>b : { c?: string | undefined; }
|
||||
|
||||
type C = typeof foo.a.b.c;
|
||||
>C : string | undefined
|
||||
>foo.a.b.c : string | undefined
|
||||
>foo.a.b : { c?: string; }
|
||||
>foo.a : { b?: { c?: string; }; }
|
||||
>foo.a.b : { c?: string | undefined; }
|
||||
>foo.a : { b?: { c?: string | undefined; } | undefined; }
|
||||
>foo : DeepOptional
|
||||
>a : { b?: { c?: string; }; }
|
||||
>b : { c?: string; }
|
||||
>a : { b?: { c?: string | undefined; } | undefined; }
|
||||
>b : { c?: string | undefined; }
|
||||
>c : string | undefined
|
||||
|
||||
if (foo.a.b.c) {
|
||||
>foo.a.b.c : string | undefined
|
||||
>foo.a.b : { c?: string; }
|
||||
>foo.a : { b?: { c?: string; }; }
|
||||
>foo.a.b : { c?: string | undefined; }
|
||||
>foo.a : { b?: { c?: string | undefined; } | undefined; }
|
||||
>foo : DeepOptional
|
||||
>a : { b?: { c?: string; }; }
|
||||
>b : { c?: string; }
|
||||
>a : { b?: { c?: string | undefined; } | undefined; }
|
||||
>b : { c?: string | undefined; }
|
||||
>c : string | undefined
|
||||
|
||||
type A = typeof foo.a;
|
||||
>A : { b?: { c?: string; }; }
|
||||
>foo.a : { b?: { c?: string; }; }
|
||||
>A : { b?: { c?: string | undefined; } | undefined; }
|
||||
>foo.a : { b?: { c?: string | undefined; } | undefined; }
|
||||
>foo : DeepOptional
|
||||
>a : { b?: { c?: string; }; }
|
||||
>a : { b?: { c?: string | undefined; } | undefined; }
|
||||
|
||||
type B = typeof foo.a.b;
|
||||
>B : { c?: string; }
|
||||
>foo.a.b : { c?: string; }
|
||||
>foo.a : { b?: { c?: string; }; }
|
||||
>B : { c?: string | undefined; }
|
||||
>foo.a.b : { c?: string | undefined; }
|
||||
>foo.a : { b?: { c?: string | undefined; } | undefined; }
|
||||
>foo : DeepOptional
|
||||
>a : { b?: { c?: string; }; }
|
||||
>b : { c?: string; }
|
||||
>a : { b?: { c?: string | undefined; } | undefined; }
|
||||
>b : { c?: string | undefined; }
|
||||
|
||||
type C = typeof foo.a.b.c;
|
||||
>C : string
|
||||
>foo.a.b.c : string
|
||||
>foo.a.b : { c?: string; }
|
||||
>foo.a : { b?: { c?: string; }; }
|
||||
>foo.a.b : { c?: string | undefined; }
|
||||
>foo.a : { b?: { c?: string | undefined; } | undefined; }
|
||||
>foo : DeepOptional
|
||||
>a : { b?: { c?: string; }; }
|
||||
>b : { c?: string; }
|
||||
>a : { b?: { c?: string | undefined; } | undefined; }
|
||||
>b : { c?: string | undefined; }
|
||||
>c : string
|
||||
|
||||
for(const _ of [1]) {
|
||||
@@ -228,27 +228,27 @@ function init2(foo: DeepOptional) {
|
||||
>1 : 1
|
||||
|
||||
type A = typeof foo.a;
|
||||
>A : { b?: { c?: string; }; }
|
||||
>foo.a : { b?: { c?: string; }; }
|
||||
>A : { b?: { c?: string | undefined; } | undefined; }
|
||||
>foo.a : { b?: { c?: string | undefined; } | undefined; }
|
||||
>foo : DeepOptional
|
||||
>a : { b?: { c?: string; }; }
|
||||
>a : { b?: { c?: string | undefined; } | undefined; }
|
||||
|
||||
type B = typeof foo.a.b;
|
||||
>B : { c?: string; }
|
||||
>foo.a.b : { c?: string; }
|
||||
>foo.a : { b?: { c?: string; }; }
|
||||
>B : { c?: string | undefined; }
|
||||
>foo.a.b : { c?: string | undefined; }
|
||||
>foo.a : { b?: { c?: string | undefined; } | undefined; }
|
||||
>foo : DeepOptional
|
||||
>a : { b?: { c?: string; }; }
|
||||
>b : { c?: string; }
|
||||
>a : { b?: { c?: string | undefined; } | undefined; }
|
||||
>b : { c?: string | undefined; }
|
||||
|
||||
type C = typeof foo.a.b.c;
|
||||
>C : string
|
||||
>foo.a.b.c : string
|
||||
>foo.a.b : { c?: string; }
|
||||
>foo.a : { b?: { c?: string; }; }
|
||||
>foo.a.b : { c?: string | undefined; }
|
||||
>foo.a : { b?: { c?: string | undefined; } | undefined; }
|
||||
>foo : DeepOptional
|
||||
>a : { b?: { c?: string; }; }
|
||||
>b : { c?: string; }
|
||||
>a : { b?: { c?: string | undefined; } | undefined; }
|
||||
>b : { c?: string | undefined; }
|
||||
>c : string
|
||||
}
|
||||
}
|
||||
|
||||
@@ -158,7 +158,7 @@ declare let target_string_arr: string[];
|
||||
|
||||
[,,, ...target_string_arr] = strArray; // Should OK
|
||||
>[,,, ...target_string_arr] = strArray : string[]
|
||||
>[,,, ...target_string_arr] : [never?, never?, never?, ...string[]]
|
||||
>[,,, ...target_string_arr] : [undefined, undefined, undefined, ...string[]]
|
||||
> : undefined
|
||||
> : undefined
|
||||
> : undefined
|
||||
|
||||
@@ -20,112 +20,112 @@ type CtorOf<T> = (arg: UnionToIntersection<T>) => T;
|
||||
|
||||
interface Big {
|
||||
"0": { common?: string; "0"?: number, ref?: Obj<Big["0"]> | Func<Big["0"]>; }
|
||||
>"0" : { common?: string; "0"?: number; ref?: Obj<Big["0"]> | Func<Big["0"]>; }
|
||||
>"0" : { common?: string | undefined; "0"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; }
|
||||
>common : string | undefined
|
||||
>"0" : number | undefined
|
||||
>ref : Obj<{ common?: string; "0"?: number; ref?: Obj<Big["0"]> | Func<Big["0"]>; }> | Func<{ common?: string; "0"?: number; ref?: Obj<Big["0"]> | Func<Big["0"]>; }> | undefined
|
||||
>ref : Obj<{ common?: string | undefined; "0"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; }> | Func<{ common?: string | undefined; "0"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; }> | undefined
|
||||
|
||||
"1": { common?: string; "1"?: number, ref?: Obj<Big["1"]> | Func<Big["1"]>; }
|
||||
>"1" : { common?: string; "1"?: number; ref?: Obj<Big["1"]> | Func<Big["1"]>; }
|
||||
>"1" : { common?: string | undefined; "1"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; }
|
||||
>common : string | undefined
|
||||
>"1" : number | undefined
|
||||
>ref : Obj<{ common?: string; "1"?: number; ref?: Obj<Big["1"]> | Func<Big["1"]>; }> | Func<{ common?: string; "1"?: number; ref?: Obj<Big["1"]> | Func<Big["1"]>; }> | undefined
|
||||
>ref : Obj<{ common?: string | undefined; "1"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; }> | Func<{ common?: string | undefined; "1"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; }> | undefined
|
||||
|
||||
"2": { common?: string; "2"?: number, ref?: Obj<Big["2"]> | Func<Big["2"]>; }
|
||||
>"2" : { common?: string; "2"?: number; ref?: Obj<Big["2"]> | Func<Big["2"]>; }
|
||||
>"2" : { common?: string | undefined; "2"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; }
|
||||
>common : string | undefined
|
||||
>"2" : number | undefined
|
||||
>ref : Obj<{ common?: string; "2"?: number; ref?: Obj<Big["2"]> | Func<Big["2"]>; }> | Func<{ common?: string; "2"?: number; ref?: Obj<Big["2"]> | Func<Big["2"]>; }> | undefined
|
||||
>ref : Obj<{ common?: string | undefined; "2"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; }> | Func<{ common?: string | undefined; "2"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; }> | undefined
|
||||
|
||||
"3": { common?: string; "3"?: number, ref?: Obj<Big["3"]> | Func<Big["3"]>; }
|
||||
>"3" : { common?: string; "3"?: number; ref?: Obj<Big["3"]> | Func<Big["3"]>; }
|
||||
>"3" : { common?: string | undefined; "3"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; }
|
||||
>common : string | undefined
|
||||
>"3" : number | undefined
|
||||
>ref : Obj<{ common?: string; "3"?: number; ref?: Obj<Big["3"]> | Func<Big["3"]>; }> | Func<{ common?: string; "3"?: number; ref?: Obj<Big["3"]> | Func<Big["3"]>; }> | undefined
|
||||
>ref : Obj<{ common?: string | undefined; "3"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; }> | Func<{ common?: string | undefined; "3"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; }> | undefined
|
||||
|
||||
"4": { common?: string; "4"?: number, ref?: Obj<Big["4"]> | Func<Big["4"]>; }
|
||||
>"4" : { common?: string; "4"?: number; ref?: Obj<Big["4"]> | Func<Big["4"]>; }
|
||||
>"4" : { common?: string | undefined; "4"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; }
|
||||
>common : string | undefined
|
||||
>"4" : number | undefined
|
||||
>ref : Obj<{ common?: string; "4"?: number; ref?: Obj<Big["4"]> | Func<Big["4"]>; }> | Func<{ common?: string; "4"?: number; ref?: Obj<Big["4"]> | Func<Big["4"]>; }> | undefined
|
||||
>ref : Obj<{ common?: string | undefined; "4"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; }> | Func<{ common?: string | undefined; "4"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; }> | undefined
|
||||
|
||||
"5": { common?: string; "5"?: number, ref?: Obj<Big["5"]> | Func<Big["5"]>; }
|
||||
>"5" : { common?: string; "5"?: number; ref?: Obj<Big["5"]> | Func<Big["5"]>; }
|
||||
>"5" : { common?: string | undefined; "5"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; }
|
||||
>common : string | undefined
|
||||
>"5" : number | undefined
|
||||
>ref : Obj<{ common?: string; "5"?: number; ref?: Obj<Big["5"]> | Func<Big["5"]>; }> | Func<{ common?: string; "5"?: number; ref?: Obj<Big["5"]> | Func<Big["5"]>; }> | undefined
|
||||
>ref : Obj<{ common?: string | undefined; "5"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; }> | Func<{ common?: string | undefined; "5"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; }> | undefined
|
||||
|
||||
"6": { common?: string; "6"?: number, ref?: Obj<Big["6"]> | Func<Big["6"]>; }
|
||||
>"6" : { common?: string; "6"?: number; ref?: Obj<Big["6"]> | Func<Big["6"]>; }
|
||||
>"6" : { common?: string | undefined; "6"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; }
|
||||
>common : string | undefined
|
||||
>"6" : number | undefined
|
||||
>ref : Obj<{ common?: string; "6"?: number; ref?: Obj<Big["6"]> | Func<Big["6"]>; }> | Func<{ common?: string; "6"?: number; ref?: Obj<Big["6"]> | Func<Big["6"]>; }> | undefined
|
||||
>ref : Obj<{ common?: string | undefined; "6"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; }> | Func<{ common?: string | undefined; "6"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; }> | undefined
|
||||
|
||||
"7": { common?: string; "7"?: number, ref?: Obj<Big["7"]> | Func<Big["7"]>; }
|
||||
>"7" : { common?: string; "7"?: number; ref?: Obj<Big["7"]> | Func<Big["7"]>; }
|
||||
>"7" : { common?: string | undefined; "7"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; }
|
||||
>common : string | undefined
|
||||
>"7" : number | undefined
|
||||
>ref : Obj<{ common?: string; "7"?: number; ref?: Obj<Big["7"]> | Func<Big["7"]>; }> | Func<{ common?: string; "7"?: number; ref?: Obj<Big["7"]> | Func<Big["7"]>; }> | undefined
|
||||
>ref : Obj<{ common?: string | undefined; "7"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; }> | Func<{ common?: string | undefined; "7"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; }> | undefined
|
||||
|
||||
"8": { common?: string; "8"?: number, ref?: Obj<Big["8"]> | Func<Big["8"]>; }
|
||||
>"8" : { common?: string; "8"?: number; ref?: Obj<Big["8"]> | Func<Big["8"]>; }
|
||||
>"8" : { common?: string | undefined; "8"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; }
|
||||
>common : string | undefined
|
||||
>"8" : number | undefined
|
||||
>ref : Obj<{ common?: string; "8"?: number; ref?: Obj<Big["8"]> | Func<Big["8"]>; }> | Func<{ common?: string; "8"?: number; ref?: Obj<Big["8"]> | Func<Big["8"]>; }> | undefined
|
||||
>ref : Obj<{ common?: string | undefined; "8"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; }> | Func<{ common?: string | undefined; "8"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; }> | undefined
|
||||
|
||||
"9": { common?: string; "9"?: number, ref?: Obj<Big["9"]> | Func<Big["9"]>; }
|
||||
>"9" : { common?: string; "9"?: number; ref?: Obj<Big["9"]> | Func<Big["9"]>; }
|
||||
>"9" : { common?: string | undefined; "9"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; }
|
||||
>common : string | undefined
|
||||
>"9" : number | undefined
|
||||
>ref : Obj<{ common?: string; "9"?: number; ref?: Obj<Big["9"]> | Func<Big["9"]>; }> | Func<{ common?: string; "9"?: number; ref?: Obj<Big["9"]> | Func<Big["9"]>; }> | undefined
|
||||
>ref : Obj<{ common?: string | undefined; "9"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; }> | Func<{ common?: string | undefined; "9"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; }> | undefined
|
||||
|
||||
"10": { common?: string; "10"?: number, ref?: Obj<Big["10"]> | Func<Big["10"]>; }
|
||||
>"10" : { common?: string; "10"?: number; ref?: Obj<Big["10"]> | Func<Big["10"]>; }
|
||||
>"10" : { common?: string | undefined; "10"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; }
|
||||
>common : string | undefined
|
||||
>"10" : number | undefined
|
||||
>ref : Obj<{ common?: string; "10"?: number; ref?: Obj<Big["10"]> | Func<Big["10"]>; }> | Func<{ common?: string; "10"?: number; ref?: Obj<Big["10"]> | Func<Big["10"]>; }> | undefined
|
||||
>ref : Obj<{ common?: string | undefined; "10"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; }> | Func<{ common?: string | undefined; "10"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; }> | undefined
|
||||
|
||||
"11": { common?: string; "11"?: number, ref?: Obj<Big["11"]> | Func<Big["11"]>; }
|
||||
>"11" : { common?: string; "11"?: number; ref?: Obj<Big["11"]> | Func<Big["11"]>; }
|
||||
>"11" : { common?: string | undefined; "11"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; }
|
||||
>common : string | undefined
|
||||
>"11" : number | undefined
|
||||
>ref : Obj<{ common?: string; "11"?: number; ref?: Obj<Big["11"]> | Func<Big["11"]>; }> | Func<{ common?: string; "11"?: number; ref?: Obj<Big["11"]> | Func<Big["11"]>; }> | undefined
|
||||
>ref : Obj<{ common?: string | undefined; "11"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; }> | Func<{ common?: string | undefined; "11"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; }> | undefined
|
||||
|
||||
"12": { common?: string; "12"?: number, ref?: Obj<Big["12"]> | Func<Big["12"]>; }
|
||||
>"12" : { common?: string; "12"?: number; ref?: Obj<Big["12"]> | Func<Big["12"]>; }
|
||||
>"12" : { common?: string | undefined; "12"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; }
|
||||
>common : string | undefined
|
||||
>"12" : number | undefined
|
||||
>ref : Obj<{ common?: string; "12"?: number; ref?: Obj<Big["12"]> | Func<Big["12"]>; }> | Func<{ common?: string; "12"?: number; ref?: Obj<Big["12"]> | Func<Big["12"]>; }> | undefined
|
||||
>ref : Obj<{ common?: string | undefined; "12"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; }> | Func<{ common?: string | undefined; "12"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; }> | undefined
|
||||
|
||||
"13": { common?: string; "13"?: number, ref?: Obj<Big["13"]> | Func<Big["13"]>; }
|
||||
>"13" : { common?: string; "13"?: number; ref?: Obj<Big["13"]> | Func<Big["13"]>; }
|
||||
>"13" : { common?: string | undefined; "13"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; }
|
||||
>common : string | undefined
|
||||
>"13" : number | undefined
|
||||
>ref : Obj<{ common?: string; "13"?: number; ref?: Obj<Big["13"]> | Func<Big["13"]>; }> | Func<{ common?: string; "13"?: number; ref?: Obj<Big["13"]> | Func<Big["13"]>; }> | undefined
|
||||
>ref : Obj<{ common?: string | undefined; "13"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; }> | Func<{ common?: string | undefined; "13"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; }> | undefined
|
||||
|
||||
"14": { common?: string; "14"?: number, ref?: Obj<Big["14"]> | Func<Big["14"]>; }
|
||||
>"14" : { common?: string; "14"?: number; ref?: Obj<Big["14"]> | Func<Big["14"]>; }
|
||||
>"14" : { common?: string | undefined; "14"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; }
|
||||
>common : string | undefined
|
||||
>"14" : number | undefined
|
||||
>ref : Obj<{ common?: string; "14"?: number; ref?: Obj<Big["14"]> | Func<Big["14"]>; }> | Func<{ common?: string; "14"?: number; ref?: Obj<Big["14"]> | Func<Big["14"]>; }> | undefined
|
||||
>ref : Obj<{ common?: string | undefined; "14"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; }> | Func<{ common?: string | undefined; "14"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; }> | undefined
|
||||
|
||||
"15": { common?: string; "15"?: number, ref?: Obj<Big["15"]> | Func<Big["15"]>; }
|
||||
>"15" : { common?: string; "15"?: number; ref?: Obj<Big["15"]> | Func<Big["15"]>; }
|
||||
>"15" : { common?: string | undefined; "15"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; }
|
||||
>common : string | undefined
|
||||
>"15" : number | undefined
|
||||
>ref : Obj<{ common?: string; "15"?: number; ref?: Obj<Big["15"]> | Func<Big["15"]>; }> | Func<{ common?: string; "15"?: number; ref?: Obj<Big["15"]> | Func<Big["15"]>; }> | undefined
|
||||
>ref : Obj<{ common?: string | undefined; "15"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; }> | Func<{ common?: string | undefined; "15"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; }> | undefined
|
||||
|
||||
"16": { common?: string; "16"?: number, ref?: Obj<Big["16"]> | Func<Big["16"]>; }
|
||||
>"16" : { common?: string; "16"?: number; ref?: Obj<Big["16"]> | Func<Big["16"]>; }
|
||||
>"16" : { common?: string | undefined; "16"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; }
|
||||
>common : string | undefined
|
||||
>"16" : number | undefined
|
||||
>ref : Obj<{ common?: string; "16"?: number; ref?: Obj<Big["16"]> | Func<Big["16"]>; }> | Func<{ common?: string; "16"?: number; ref?: Obj<Big["16"]> | Func<Big["16"]>; }> | undefined
|
||||
>ref : Obj<{ common?: string | undefined; "16"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; }> | Func<{ common?: string | undefined; "16"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; }> | undefined
|
||||
|
||||
"17": { common?: string; "17"?: number, ref?: Obj<Big["17"]> | Func<Big["17"]>; }
|
||||
>"17" : { common?: string; "17"?: number; ref?: Obj<Big["17"]> | Func<Big["17"]>; }
|
||||
>"17" : { common?: string | undefined; "17"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; }
|
||||
>common : string | undefined
|
||||
>"17" : number | undefined
|
||||
>ref : Obj<{ common?: string; "17"?: number; ref?: Obj<Big["17"]> | Func<Big["17"]>; }> | Func<{ common?: string; "17"?: number; ref?: Obj<Big["17"]> | Func<Big["17"]>; }> | undefined
|
||||
>ref : Obj<{ common?: string | undefined; "17"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; }> | Func<{ common?: string | undefined; "17"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; }> | undefined
|
||||
}
|
||||
declare function getCtor<T extends keyof Big>(comp: T): CtorOf<Big[T]>
|
||||
>getCtor : <T extends keyof Big>(comp: T) => CtorOf<Big[T]>
|
||||
@@ -135,15 +135,15 @@ declare var all: keyof Big;
|
||||
>all : keyof Big
|
||||
|
||||
const ctor = getCtor(all);
|
||||
>ctor : CtorOf<{ common?: string; "0"?: number; ref?: Obj<any> | Func<any>; } | { common?: string; "1"?: number; ref?: Obj<any> | Func<any>; } | { common?: string; "2"?: number; ref?: Obj<any> | Func<any>; } | { common?: string; "3"?: number; ref?: Obj<any> | Func<any>; } | { common?: string; "4"?: number; ref?: Obj<any> | Func<any>; } | { common?: string; "5"?: number; ref?: Obj<any> | Func<any>; } | { common?: string; "6"?: number; ref?: Obj<any> | Func<any>; } | { common?: string; "7"?: number; ref?: Obj<any> | Func<any>; } | { common?: string; "8"?: number; ref?: Obj<any> | Func<any>; } | { common?: string; "9"?: number; ref?: Obj<any> | Func<any>; } | { common?: string; "10"?: number; ref?: Obj<any> | Func<any>; } | { common?: string; "11"?: number; ref?: Obj<any> | Func<any>; } | { common?: string; "12"?: number; ref?: Obj<any> | Func<any>; } | { common?: string; "13"?: number; ref?: Obj<any> | Func<any>; } | { common?: string; "14"?: number; ref?: Obj<any> | Func<any>; } | { common?: string; "15"?: number; ref?: Obj<any> | Func<any>; } | { common?: string; "16"?: number; ref?: Obj<any> | Func<any>; } | { common?: string; "17"?: number; ref?: Obj<any> | Func<any>; }>
|
||||
>getCtor(all) : CtorOf<{ common?: string; "0"?: number; ref?: Obj<any> | Func<any>; } | { common?: string; "1"?: number; ref?: Obj<any> | Func<any>; } | { common?: string; "2"?: number; ref?: Obj<any> | Func<any>; } | { common?: string; "3"?: number; ref?: Obj<any> | Func<any>; } | { common?: string; "4"?: number; ref?: Obj<any> | Func<any>; } | { common?: string; "5"?: number; ref?: Obj<any> | Func<any>; } | { common?: string; "6"?: number; ref?: Obj<any> | Func<any>; } | { common?: string; "7"?: number; ref?: Obj<any> | Func<any>; } | { common?: string; "8"?: number; ref?: Obj<any> | Func<any>; } | { common?: string; "9"?: number; ref?: Obj<any> | Func<any>; } | { common?: string; "10"?: number; ref?: Obj<any> | Func<any>; } | { common?: string; "11"?: number; ref?: Obj<any> | Func<any>; } | { common?: string; "12"?: number; ref?: Obj<any> | Func<any>; } | { common?: string; "13"?: number; ref?: Obj<any> | Func<any>; } | { common?: string; "14"?: number; ref?: Obj<any> | Func<any>; } | { common?: string; "15"?: number; ref?: Obj<any> | Func<any>; } | { common?: string; "16"?: number; ref?: Obj<any> | Func<any>; } | { common?: string; "17"?: number; ref?: Obj<any> | Func<any>; }>
|
||||
>ctor : CtorOf<{ common?: string | undefined; "0"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; } | { common?: string | undefined; "1"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; } | { common?: string | undefined; "2"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; } | { common?: string | undefined; "3"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; } | { common?: string | undefined; "4"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; } | { common?: string | undefined; "5"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; } | { common?: string | undefined; "6"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; } | { common?: string | undefined; "7"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; } | { common?: string | undefined; "8"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; } | { common?: string | undefined; "9"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; } | { common?: string | undefined; "10"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; } | { common?: string | undefined; "11"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; } | { common?: string | undefined; "12"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; } | { common?: string | undefined; "13"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; } | { common?: string | undefined; "14"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; } | { common?: string | undefined; "15"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; } | { common?: string | undefined; "16"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; } | { common?: string | undefined; "17"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; }>
|
||||
>getCtor(all) : CtorOf<{ common?: string | undefined; "0"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; } | { common?: string | undefined; "1"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; } | { common?: string | undefined; "2"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; } | { common?: string | undefined; "3"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; } | { common?: string | undefined; "4"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; } | { common?: string | undefined; "5"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; } | { common?: string | undefined; "6"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; } | { common?: string | undefined; "7"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; } | { common?: string | undefined; "8"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; } | { common?: string | undefined; "9"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; } | { common?: string | undefined; "10"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; } | { common?: string | undefined; "11"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; } | { common?: string | undefined; "12"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; } | { common?: string | undefined; "13"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; } | { common?: string | undefined; "14"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; } | { common?: string | undefined; "15"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; } | { common?: string | undefined; "16"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; } | { common?: string | undefined; "17"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; }>
|
||||
>getCtor : <T extends keyof Big>(comp: T) => CtorOf<Big[T]>
|
||||
>all : keyof Big
|
||||
|
||||
const comp = ctor({ common: "ok", ref: x => console.log(x) });
|
||||
>comp : { common?: string; "0"?: number; ref?: Obj<any> | Func<any>; } | { common?: string; "1"?: number; ref?: Obj<any> | Func<any>; } | { common?: string; "2"?: number; ref?: Obj<any> | Func<any>; } | { common?: string; "3"?: number; ref?: Obj<any> | Func<any>; } | { common?: string; "4"?: number; ref?: Obj<any> | Func<any>; } | { common?: string; "5"?: number; ref?: Obj<any> | Func<any>; } | { common?: string; "6"?: number; ref?: Obj<any> | Func<any>; } | { common?: string; "7"?: number; ref?: Obj<any> | Func<any>; } | { common?: string; "8"?: number; ref?: Obj<any> | Func<any>; } | { common?: string; "9"?: number; ref?: Obj<any> | Func<any>; } | { common?: string; "10"?: number; ref?: Obj<any> | Func<any>; } | { common?: string; "11"?: number; ref?: Obj<any> | Func<any>; } | { common?: string; "12"?: number; ref?: Obj<any> | Func<any>; } | { common?: string; "13"?: number; ref?: Obj<any> | Func<any>; } | { common?: string; "14"?: number; ref?: Obj<any> | Func<any>; } | { common?: string; "15"?: number; ref?: Obj<any> | Func<any>; } | { common?: string; "16"?: number; ref?: Obj<any> | Func<any>; } | { common?: string; "17"?: number; ref?: Obj<any> | Func<any>; }
|
||||
>ctor({ common: "ok", ref: x => console.log(x) }) : { common?: string; "0"?: number; ref?: Obj<any> | Func<any>; } | { common?: string; "1"?: number; ref?: Obj<any> | Func<any>; } | { common?: string; "2"?: number; ref?: Obj<any> | Func<any>; } | { common?: string; "3"?: number; ref?: Obj<any> | Func<any>; } | { common?: string; "4"?: number; ref?: Obj<any> | Func<any>; } | { common?: string; "5"?: number; ref?: Obj<any> | Func<any>; } | { common?: string; "6"?: number; ref?: Obj<any> | Func<any>; } | { common?: string; "7"?: number; ref?: Obj<any> | Func<any>; } | { common?: string; "8"?: number; ref?: Obj<any> | Func<any>; } | { common?: string; "9"?: number; ref?: Obj<any> | Func<any>; } | { common?: string; "10"?: number; ref?: Obj<any> | Func<any>; } | { common?: string; "11"?: number; ref?: Obj<any> | Func<any>; } | { common?: string; "12"?: number; ref?: Obj<any> | Func<any>; } | { common?: string; "13"?: number; ref?: Obj<any> | Func<any>; } | { common?: string; "14"?: number; ref?: Obj<any> | Func<any>; } | { common?: string; "15"?: number; ref?: Obj<any> | Func<any>; } | { common?: string; "16"?: number; ref?: Obj<any> | Func<any>; } | { common?: string; "17"?: number; ref?: Obj<any> | Func<any>; }
|
||||
>ctor : CtorOf<{ common?: string; "0"?: number; ref?: Obj<any> | Func<any>; } | { common?: string; "1"?: number; ref?: Obj<any> | Func<any>; } | { common?: string; "2"?: number; ref?: Obj<any> | Func<any>; } | { common?: string; "3"?: number; ref?: Obj<any> | Func<any>; } | { common?: string; "4"?: number; ref?: Obj<any> | Func<any>; } | { common?: string; "5"?: number; ref?: Obj<any> | Func<any>; } | { common?: string; "6"?: number; ref?: Obj<any> | Func<any>; } | { common?: string; "7"?: number; ref?: Obj<any> | Func<any>; } | { common?: string; "8"?: number; ref?: Obj<any> | Func<any>; } | { common?: string; "9"?: number; ref?: Obj<any> | Func<any>; } | { common?: string; "10"?: number; ref?: Obj<any> | Func<any>; } | { common?: string; "11"?: number; ref?: Obj<any> | Func<any>; } | { common?: string; "12"?: number; ref?: Obj<any> | Func<any>; } | { common?: string; "13"?: number; ref?: Obj<any> | Func<any>; } | { common?: string; "14"?: number; ref?: Obj<any> | Func<any>; } | { common?: string; "15"?: number; ref?: Obj<any> | Func<any>; } | { common?: string; "16"?: number; ref?: Obj<any> | Func<any>; } | { common?: string; "17"?: number; ref?: Obj<any> | Func<any>; }>
|
||||
>comp : { common?: string | undefined; "0"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; } | { common?: string | undefined; "1"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; } | { common?: string | undefined; "2"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; } | { common?: string | undefined; "3"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; } | { common?: string | undefined; "4"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; } | { common?: string | undefined; "5"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; } | { common?: string | undefined; "6"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; } | { common?: string | undefined; "7"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; } | { common?: string | undefined; "8"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; } | { common?: string | undefined; "9"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; } | { common?: string | undefined; "10"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; } | { common?: string | undefined; "11"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; } | { common?: string | undefined; "12"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; } | { common?: string | undefined; "13"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; } | { common?: string | undefined; "14"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; } | { common?: string | undefined; "15"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; } | { common?: string | undefined; "16"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; } | { common?: string | undefined; "17"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; }
|
||||
>ctor({ common: "ok", ref: x => console.log(x) }) : { common?: string | undefined; "0"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; } | { common?: string | undefined; "1"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; } | { common?: string | undefined; "2"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; } | { common?: string | undefined; "3"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; } | { common?: string | undefined; "4"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; } | { common?: string | undefined; "5"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; } | { common?: string | undefined; "6"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; } | { common?: string | undefined; "7"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; } | { common?: string | undefined; "8"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; } | { common?: string | undefined; "9"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; } | { common?: string | undefined; "10"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; } | { common?: string | undefined; "11"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; } | { common?: string | undefined; "12"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; } | { common?: string | undefined; "13"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; } | { common?: string | undefined; "14"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; } | { common?: string | undefined; "15"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; } | { common?: string | undefined; "16"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; } | { common?: string | undefined; "17"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; }
|
||||
>ctor : CtorOf<{ common?: string | undefined; "0"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; } | { common?: string | undefined; "1"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; } | { common?: string | undefined; "2"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; } | { common?: string | undefined; "3"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; } | { common?: string | undefined; "4"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; } | { common?: string | undefined; "5"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; } | { common?: string | undefined; "6"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; } | { common?: string | undefined; "7"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; } | { common?: string | undefined; "8"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; } | { common?: string | undefined; "9"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; } | { common?: string | undefined; "10"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; } | { common?: string | undefined; "11"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; } | { common?: string | undefined; "12"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; } | { common?: string | undefined; "13"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; } | { common?: string | undefined; "14"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; } | { common?: string | undefined; "15"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; } | { common?: string | undefined; "16"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; } | { common?: string | undefined; "17"?: number | undefined; ref?: Obj<any> | Func<any> | undefined; }>
|
||||
>{ common: "ok", ref: x => console.log(x) } : { common: string; ref: (x: any) => void; }
|
||||
>common : string
|
||||
>"ok" : "ok"
|
||||
|
||||
@@ -41,14 +41,14 @@ const e2: E2 = E2.ONE;
|
||||
|
||||
b1[1] = "a";
|
||||
>b1[1] = "a" : "a"
|
||||
>b1[1] : string
|
||||
>b1[1] : string | undefined
|
||||
>b1 : Bins1
|
||||
>1 : 1
|
||||
>"a" : "a"
|
||||
|
||||
b1[e1] = "b";
|
||||
>b1[e1] = "b" : "b"
|
||||
>b1[e1] : string
|
||||
>b1[e1] : string | undefined
|
||||
>b1 : Bins1
|
||||
>e1 : E1.ONE
|
||||
>"b" : "b"
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
tests/cases/conformance/expressions/objectLiterals/objectLiteralNormalization.ts(7,14): error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/expressions/objectLiterals/objectLiteralNormalization.ts(8,1): error TS2322: Type '{ b: string; }' is not assignable to type '{ a: number; b?: never; c?: never; } | { a: number; b: string; c?: never; } | { a: number; b: string; c: boolean; }'.
|
||||
tests/cases/conformance/expressions/objectLiterals/objectLiteralNormalization.ts(7,14): error TS2322: Type 'number' is not assignable to type 'string | undefined'.
|
||||
tests/cases/conformance/expressions/objectLiterals/objectLiteralNormalization.ts(8,1): error TS2322: Type '{ b: string; }' is not assignable to type '{ a: number; b?: undefined; c?: undefined; } | { a: number; b: string; c?: undefined; } | { a: number; b: string; c: boolean; }'.
|
||||
Type '{ b: string; }' is missing the following properties from type '{ a: number; b: string; c: boolean; }': a, c
|
||||
tests/cases/conformance/expressions/objectLiterals/objectLiteralNormalization.ts(9,1): error TS2322: Type '{ c: true; }' is not assignable to type '{ a: number; b?: never; c?: never; } | { a: number; b: string; c?: never; } | { a: number; b: string; c: boolean; }'.
|
||||
tests/cases/conformance/expressions/objectLiterals/objectLiteralNormalization.ts(9,1): error TS2322: Type '{ c: true; }' is not assignable to type '{ a: number; b?: undefined; c?: undefined; } | { a: number; b: string; c?: undefined; } | { a: number; b: string; c: boolean; }'.
|
||||
Type '{ c: true; }' is missing the following properties from type '{ a: number; b: string; c: boolean; }': a, b
|
||||
tests/cases/conformance/expressions/objectLiterals/objectLiteralNormalization.ts(17,1): error TS2322: Type '{ a: string; b: number; }' is not assignable to type '{ a: number; b: number; } | { a: string; b?: never; } | { a?: never; b?: never; }'.
|
||||
Type '{ a: string; b: number; }' is not assignable to type '{ a?: never; b?: never; }'.
|
||||
tests/cases/conformance/expressions/objectLiterals/objectLiteralNormalization.ts(17,1): error TS2322: Type '{ a: string; b: number; }' is not assignable to type '{ a: number; b: number; } | { a: string; b?: undefined; } | { a?: undefined; b?: undefined; }'.
|
||||
Type '{ a: string; b: number; }' is not assignable to type '{ a?: undefined; b?: undefined; }'.
|
||||
Types of property 'a' are incompatible.
|
||||
Type 'string' is not assignable to type 'never'.
|
||||
tests/cases/conformance/expressions/objectLiterals/objectLiteralNormalization.ts(18,1): error TS2322: Type '{ a: number; }' is not assignable to type '{ a: number; b: number; } | { a: string; b?: never; } | { a?: never; b?: never; }'.
|
||||
Type 'string' is not assignable to type 'undefined'.
|
||||
tests/cases/conformance/expressions/objectLiterals/objectLiteralNormalization.ts(18,1): error TS2322: Type '{ a: number; }' is not assignable to type '{ a: number; b: number; } | { a: string; b?: undefined; } | { a?: undefined; b?: undefined; }'.
|
||||
Property 'b' is missing in type '{ a: number; }' but required in type '{ a: number; b: number; }'.
|
||||
tests/cases/conformance/expressions/objectLiterals/objectLiteralNormalization.ts(48,20): error TS2322: Type '2' is not assignable to type '1'.
|
||||
tests/cases/conformance/expressions/objectLiterals/objectLiteralNormalization.ts(49,14): error TS2322: Type '2' is not assignable to type '1'.
|
||||
@@ -22,15 +22,15 @@ tests/cases/conformance/expressions/objectLiterals/objectLiteralNormalization.ts
|
||||
a1 = { a: 1 };
|
||||
a1 = { a: 0, b: 0 }; // Error
|
||||
~
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
!!! related TS6500 tests/cases/conformance/expressions/objectLiterals/objectLiteralNormalization.ts:2:47: The expected type comes from property 'b' which is declared here on type '{ a: number; b?: never; c?: never; } | { a: number; b: string; c?: never; } | { a: number; b: string; c: boolean; }'
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string | undefined'.
|
||||
!!! related TS6500 tests/cases/conformance/expressions/objectLiterals/objectLiteralNormalization.ts:2:47: The expected type comes from property 'b' which is declared here on type '{ a: number; b?: undefined; c?: undefined; } | { a: number; b: string; c?: undefined; } | { a: number; b: string; c: boolean; }'
|
||||
a1 = { b: "y" }; // Error
|
||||
~~
|
||||
!!! error TS2322: Type '{ b: string; }' is not assignable to type '{ a: number; b?: never; c?: never; } | { a: number; b: string; c?: never; } | { a: number; b: string; c: boolean; }'.
|
||||
!!! error TS2322: Type '{ b: string; }' is not assignable to type '{ a: number; b?: undefined; c?: undefined; } | { a: number; b: string; c?: undefined; } | { a: number; b: string; c: boolean; }'.
|
||||
!!! error TS2322: Type '{ b: string; }' is missing the following properties from type '{ a: number; b: string; c: boolean; }': a, c
|
||||
a1 = { c: true }; // Error
|
||||
~~
|
||||
!!! error TS2322: Type '{ c: true; }' is not assignable to type '{ a: number; b?: never; c?: never; } | { a: number; b: string; c?: never; } | { a: number; b: string; c: boolean; }'.
|
||||
!!! error TS2322: Type '{ c: true; }' is not assignable to type '{ a: number; b?: undefined; c?: undefined; } | { a: number; b: string; c?: undefined; } | { a: number; b: string; c: boolean; }'.
|
||||
!!! error TS2322: Type '{ c: true; }' is missing the following properties from type '{ a: number; b: string; c: boolean; }': a, b
|
||||
|
||||
let a2 = [{ a: 1, b: 2 }, { a: "abc" }, {}][0];
|
||||
@@ -41,13 +41,13 @@ tests/cases/conformance/expressions/objectLiterals/objectLiteralNormalization.ts
|
||||
a2 = {};
|
||||
a2 = { a: "def", b: 20 }; // Error
|
||||
~~
|
||||
!!! error TS2322: Type '{ a: string; b: number; }' is not assignable to type '{ a: number; b: number; } | { a: string; b?: never; } | { a?: never; b?: never; }'.
|
||||
!!! error TS2322: Type '{ a: string; b: number; }' is not assignable to type '{ a?: never; b?: never; }'.
|
||||
!!! error TS2322: Type '{ a: string; b: number; }' is not assignable to type '{ a: number; b: number; } | { a: string; b?: undefined; } | { a?: undefined; b?: undefined; }'.
|
||||
!!! error TS2322: Type '{ a: string; b: number; }' is not assignable to type '{ a?: undefined; b?: undefined; }'.
|
||||
!!! error TS2322: Types of property 'a' are incompatible.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'never'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'undefined'.
|
||||
a2 = { a: 1 }; // Error
|
||||
~~
|
||||
!!! error TS2322: Type '{ a: number; }' is not assignable to type '{ a: number; b: number; } | { a: string; b?: never; } | { a?: never; b?: never; }'.
|
||||
!!! error TS2322: Type '{ a: number; }' is not assignable to type '{ a: number; b: number; } | { a: string; b?: undefined; } | { a?: undefined; b?: undefined; }'.
|
||||
!!! error TS2322: Property 'b' is missing in type '{ a: number; }' but required in type '{ a: number; b: number; }'.
|
||||
!!! related TS2728 tests/cases/conformance/expressions/objectLiterals/objectLiteralNormalization.ts:11:19: 'b' is declared here.
|
||||
|
||||
|
||||
@@ -104,12 +104,12 @@ var e4 = f({ a: 2 }, data);
|
||||
//// [objectLiteralNormalization.d.ts]
|
||||
declare let a1: {
|
||||
a: number;
|
||||
b?: never;
|
||||
c?: never;
|
||||
b?: undefined;
|
||||
c?: undefined;
|
||||
} | {
|
||||
a: number;
|
||||
b: string;
|
||||
c?: never;
|
||||
c?: undefined;
|
||||
} | {
|
||||
a: number;
|
||||
b: string;
|
||||
@@ -120,10 +120,10 @@ declare let a2: {
|
||||
b: number;
|
||||
} | {
|
||||
a: string;
|
||||
b?: never;
|
||||
b?: undefined;
|
||||
} | {
|
||||
a?: never;
|
||||
b?: never;
|
||||
a?: undefined;
|
||||
b?: undefined;
|
||||
};
|
||||
declare let b1: {
|
||||
a: string;
|
||||
@@ -156,25 +156,25 @@ declare let opts: {
|
||||
baz?: boolean;
|
||||
};
|
||||
declare let c1: {
|
||||
foo?: string;
|
||||
bar?: string;
|
||||
baz?: boolean;
|
||||
foo?: string | undefined;
|
||||
bar?: string | undefined;
|
||||
baz?: boolean | undefined;
|
||||
};
|
||||
declare let c2: {
|
||||
foo?: string;
|
||||
bar?: string;
|
||||
baz?: boolean;
|
||||
foo?: string | undefined;
|
||||
bar?: string | undefined;
|
||||
baz?: boolean | undefined;
|
||||
};
|
||||
declare let c3: {
|
||||
a: number;
|
||||
b: number;
|
||||
} | {
|
||||
a?: never;
|
||||
b?: never;
|
||||
a?: undefined;
|
||||
b?: undefined;
|
||||
};
|
||||
declare let c4: {
|
||||
a?: never;
|
||||
b?: never;
|
||||
a?: undefined;
|
||||
b?: undefined;
|
||||
} | {
|
||||
a: number;
|
||||
b: number;
|
||||
@@ -184,21 +184,21 @@ declare let d1: {
|
||||
pos: {
|
||||
x: number;
|
||||
y: number;
|
||||
a?: never;
|
||||
b?: never;
|
||||
a?: undefined;
|
||||
b?: undefined;
|
||||
};
|
||||
} | {
|
||||
kind: string;
|
||||
pos: {
|
||||
a: string;
|
||||
x?: never;
|
||||
y?: never;
|
||||
b?: never;
|
||||
x?: undefined;
|
||||
y?: undefined;
|
||||
b?: undefined;
|
||||
} | {
|
||||
b: number;
|
||||
x?: never;
|
||||
y?: never;
|
||||
a?: never;
|
||||
x?: undefined;
|
||||
y?: undefined;
|
||||
a?: undefined;
|
||||
};
|
||||
};
|
||||
declare function f<T>(...items: T[]): T;
|
||||
@@ -212,17 +212,17 @@ declare let e1: {
|
||||
b: number;
|
||||
} | {
|
||||
a: string;
|
||||
b?: never;
|
||||
b?: undefined;
|
||||
} | {
|
||||
a?: never;
|
||||
b?: never;
|
||||
a?: undefined;
|
||||
b?: undefined;
|
||||
};
|
||||
declare let e2: {
|
||||
a?: never;
|
||||
b?: never;
|
||||
a?: undefined;
|
||||
b?: undefined;
|
||||
} | {
|
||||
a: string;
|
||||
b?: never;
|
||||
b?: undefined;
|
||||
} | {
|
||||
a: number;
|
||||
b: number;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
=== tests/cases/conformance/expressions/objectLiterals/objectLiteralNormalization.ts ===
|
||||
// Object literals in unions are normalized upon widening
|
||||
let a1 = [{ a: 0 }, { a: 1, b: "x" }, { a: 2, b: "y", c: true }][0];
|
||||
>a1 : { a: number; b?: never; c?: never; } | { a: number; b: string; c?: never; } | { a: number; b: string; c: boolean; }
|
||||
>a1 : { a: number; b?: undefined; c?: undefined; } | { a: number; b: string; c?: undefined; } | { a: number; b: string; c: boolean; }
|
||||
>[{ a: 0 }, { a: 1, b: "x" }, { a: 2, b: "y", c: true }][0] : { a: number; } | { a: number; b: string; } | { a: number; b: string; c: boolean; }
|
||||
>[{ a: 0 }, { a: 1, b: "x" }, { a: 2, b: "y", c: true }] : ({ a: number; } | { a: number; b: string; } | { a: number; b: string; c: boolean; })[]
|
||||
>{ a: 0 } : { a: number; }
|
||||
@@ -23,29 +23,29 @@ let a1 = [{ a: 0 }, { a: 1, b: "x" }, { a: 2, b: "y", c: true }][0];
|
||||
|
||||
a1.a; // number
|
||||
>a1.a : number
|
||||
>a1 : { a: number; b?: never; c?: never; } | { a: number; b: string; c?: never; } | { a: number; b: string; c: boolean; }
|
||||
>a1 : { a: number; b?: undefined; c?: undefined; } | { a: number; b: string; c?: undefined; } | { a: number; b: string; c: boolean; }
|
||||
>a : number
|
||||
|
||||
a1.b; // string | undefined
|
||||
>a1.b : string | undefined
|
||||
>a1 : { a: number; b?: never; c?: never; } | { a: number; b: string; c?: never; } | { a: number; b: string; c: boolean; }
|
||||
>a1 : { a: number; b?: undefined; c?: undefined; } | { a: number; b: string; c?: undefined; } | { a: number; b: string; c: boolean; }
|
||||
>b : string | undefined
|
||||
|
||||
a1.c; // boolean | undefined
|
||||
>a1.c : boolean | undefined
|
||||
>a1 : { a: number; b?: never; c?: never; } | { a: number; b: string; c?: never; } | { a: number; b: string; c: boolean; }
|
||||
>a1 : { a: number; b?: undefined; c?: undefined; } | { a: number; b: string; c?: undefined; } | { a: number; b: string; c: boolean; }
|
||||
>c : boolean | undefined
|
||||
|
||||
a1 = { a: 1 };
|
||||
>a1 = { a: 1 } : { a: number; }
|
||||
>a1 : { a: number; b?: never; c?: never; } | { a: number; b: string; c?: never; } | { a: number; b: string; c: boolean; }
|
||||
>a1 : { a: number; b?: undefined; c?: undefined; } | { a: number; b: string; c?: undefined; } | { a: number; b: string; c: boolean; }
|
||||
>{ a: 1 } : { a: number; }
|
||||
>a : number
|
||||
>1 : 1
|
||||
|
||||
a1 = { a: 0, b: 0 }; // Error
|
||||
>a1 = { a: 0, b: 0 } : { a: number; b: number; }
|
||||
>a1 : { a: number; b?: never; c?: never; } | { a: number; b: string; c?: never; } | { a: number; b: string; c: boolean; }
|
||||
>a1 : { a: number; b?: undefined; c?: undefined; } | { a: number; b: string; c?: undefined; } | { a: number; b: string; c: boolean; }
|
||||
>{ a: 0, b: 0 } : { a: number; b: number; }
|
||||
>a : number
|
||||
>0 : 0
|
||||
@@ -54,20 +54,20 @@ a1 = { a: 0, b: 0 }; // Error
|
||||
|
||||
a1 = { b: "y" }; // Error
|
||||
>a1 = { b: "y" } : { b: string; }
|
||||
>a1 : { a: number; b?: never; c?: never; } | { a: number; b: string; c?: never; } | { a: number; b: string; c: boolean; }
|
||||
>a1 : { a: number; b?: undefined; c?: undefined; } | { a: number; b: string; c?: undefined; } | { a: number; b: string; c: boolean; }
|
||||
>{ b: "y" } : { b: string; }
|
||||
>b : string
|
||||
>"y" : "y"
|
||||
|
||||
a1 = { c: true }; // Error
|
||||
>a1 = { c: true } : { c: true; }
|
||||
>a1 : { a: number; b?: never; c?: never; } | { a: number; b: string; c?: never; } | { a: number; b: string; c: boolean; }
|
||||
>a1 : { a: number; b?: undefined; c?: undefined; } | { a: number; b: string; c?: undefined; } | { a: number; b: string; c: boolean; }
|
||||
>{ c: true } : { c: true; }
|
||||
>c : true
|
||||
>true : true
|
||||
|
||||
let a2 = [{ a: 1, b: 2 }, { a: "abc" }, {}][0];
|
||||
>a2 : { a: number; b: number; } | { a: string; b?: never; } | { a?: never; b?: never; }
|
||||
>a2 : { a: number; b: number; } | { a: string; b?: undefined; } | { a?: undefined; b?: undefined; }
|
||||
>[{ a: 1, b: 2 }, { a: "abc" }, {}][0] : { a: number; b: number; } | { a: string; } | {}
|
||||
>[{ a: 1, b: 2 }, { a: "abc" }, {}] : ({ a: number; b: number; } | { a: string; } | {})[]
|
||||
>{ a: 1, b: 2 } : { a: number; b: number; }
|
||||
@@ -83,17 +83,17 @@ let a2 = [{ a: 1, b: 2 }, { a: "abc" }, {}][0];
|
||||
|
||||
a2.a; // string | number | undefined
|
||||
>a2.a : string | number | undefined
|
||||
>a2 : { a: number; b: number; } | { a: string; b?: never; } | { a?: never; b?: never; }
|
||||
>a2 : { a: number; b: number; } | { a: string; b?: undefined; } | { a?: undefined; b?: undefined; }
|
||||
>a : string | number | undefined
|
||||
|
||||
a2.b; // number | undefined
|
||||
>a2.b : number | undefined
|
||||
>a2 : { a: number; b: number; } | { a: string; b?: never; } | { a?: never; b?: never; }
|
||||
>a2 : { a: number; b: number; } | { a: string; b?: undefined; } | { a?: undefined; b?: undefined; }
|
||||
>b : number | undefined
|
||||
|
||||
a2 = { a: 10, b: 20 };
|
||||
>a2 = { a: 10, b: 20 } : { a: number; b: number; }
|
||||
>a2 : { a: number; b: number; } | { a: string; b?: never; } | { a?: never; b?: never; }
|
||||
>a2 : { a: number; b: number; } | { a: string; b?: undefined; } | { a?: undefined; b?: undefined; }
|
||||
>{ a: 10, b: 20 } : { a: number; b: number; }
|
||||
>a : number
|
||||
>10 : 10
|
||||
@@ -102,19 +102,19 @@ a2 = { a: 10, b: 20 };
|
||||
|
||||
a2 = { a: "def" };
|
||||
>a2 = { a: "def" } : { a: string; }
|
||||
>a2 : { a: number; b: number; } | { a: string; b?: never; } | { a?: never; b?: never; }
|
||||
>a2 : { a: number; b: number; } | { a: string; b?: undefined; } | { a?: undefined; b?: undefined; }
|
||||
>{ a: "def" } : { a: string; }
|
||||
>a : string
|
||||
>"def" : "def"
|
||||
|
||||
a2 = {};
|
||||
>a2 = {} : {}
|
||||
>a2 : { a: number; b: number; } | { a: string; b?: never; } | { a?: never; b?: never; }
|
||||
>a2 : { a: number; b: number; } | { a: string; b?: undefined; } | { a?: undefined; b?: undefined; }
|
||||
>{} : {}
|
||||
|
||||
a2 = { a: "def", b: 20 }; // Error
|
||||
>a2 = { a: "def", b: 20 } : { a: string; b: number; }
|
||||
>a2 : { a: number; b: number; } | { a: string; b?: never; } | { a?: never; b?: never; }
|
||||
>a2 : { a: number; b: number; } | { a: string; b?: undefined; } | { a?: undefined; b?: undefined; }
|
||||
>{ a: "def", b: 20 } : { a: string; b: number; }
|
||||
>a : string
|
||||
>"def" : "def"
|
||||
@@ -123,7 +123,7 @@ a2 = { a: "def", b: 20 }; // Error
|
||||
|
||||
a2 = { a: 1 }; // Error
|
||||
>a2 = { a: 1 } : { a: number; }
|
||||
>a2 : { a: number; b: number; } | { a: string; b?: never; } | { a?: never; b?: never; }
|
||||
>a2 : { a: number; b: number; } | { a: string; b?: undefined; } | { a?: undefined; b?: undefined; }
|
||||
>{ a: 1 } : { a: number; }
|
||||
>a : number
|
||||
>1 : 1
|
||||
@@ -151,29 +151,29 @@ let b3 = { ...b2 };
|
||||
// Before widening {} acts like { [x: string]: undefined }, which is a
|
||||
// subtype of types with all optional properties
|
||||
declare let opts: { foo?: string, bar?: string, baz?: boolean };
|
||||
>opts : { foo?: string; bar?: string; baz?: boolean; }
|
||||
>opts : { foo?: string | undefined; bar?: string | undefined; baz?: boolean | undefined; }
|
||||
>foo : string | undefined
|
||||
>bar : string | undefined
|
||||
>baz : boolean | undefined
|
||||
|
||||
let c1 = !true ? {} : opts;
|
||||
>c1 : { foo?: string; bar?: string; baz?: boolean; }
|
||||
>!true ? {} : opts : { foo?: string; bar?: string; baz?: boolean; }
|
||||
>c1 : { foo?: string | undefined; bar?: string | undefined; baz?: boolean | undefined; }
|
||||
>!true ? {} : opts : { foo?: string | undefined; bar?: string | undefined; baz?: boolean | undefined; }
|
||||
>!true : false
|
||||
>true : true
|
||||
>{} : {}
|
||||
>opts : { foo?: string; bar?: string; baz?: boolean; }
|
||||
>opts : { foo?: string | undefined; bar?: string | undefined; baz?: boolean | undefined; }
|
||||
|
||||
let c2 = !true ? opts : {};
|
||||
>c2 : { foo?: string; bar?: string; baz?: boolean; }
|
||||
>!true ? opts : {} : { foo?: string; bar?: string; baz?: boolean; }
|
||||
>c2 : { foo?: string | undefined; bar?: string | undefined; baz?: boolean | undefined; }
|
||||
>!true ? opts : {} : { foo?: string | undefined; bar?: string | undefined; baz?: boolean | undefined; }
|
||||
>!true : false
|
||||
>true : true
|
||||
>opts : { foo?: string; bar?: string; baz?: boolean; }
|
||||
>opts : { foo?: string | undefined; bar?: string | undefined; baz?: boolean | undefined; }
|
||||
>{} : {}
|
||||
|
||||
let c3 = !true ? { a: 0, b: 0 } : {};
|
||||
>c3 : { a: number; b: number; } | { a?: never; b?: never; }
|
||||
>c3 : { a: number; b: number; } | { a?: undefined; b?: undefined; }
|
||||
>!true ? { a: 0, b: 0 } : {} : { a: number; b: number; } | {}
|
||||
>!true : false
|
||||
>true : true
|
||||
@@ -185,7 +185,7 @@ let c3 = !true ? { a: 0, b: 0 } : {};
|
||||
>{} : {}
|
||||
|
||||
let c4 = !true ? {} : { a: 0, b: 0 };
|
||||
>c4 : { a?: never; b?: never; } | { a: number; b: number; }
|
||||
>c4 : { a?: undefined; b?: undefined; } | { a: number; b: number; }
|
||||
>!true ? {} : { a: 0, b: 0 } : {} | { a: number; b: number; }
|
||||
>!true : false
|
||||
>true : true
|
||||
@@ -198,7 +198,7 @@ let c4 = !true ? {} : { a: 0, b: 0 };
|
||||
|
||||
// Normalization applies to nested properties
|
||||
let d1 = [{ kind: 'a', pos: { x: 0, y: 0 } }, { kind: 'b', pos: !true ? { a: "x" } : { b: 0 } }][0];
|
||||
>d1 : { kind: string; pos: { x: number; y: number; a?: never; b?: never; }; } | { kind: string; pos: { a: string; x?: never; y?: never; b?: never; } | { b: number; x?: never; y?: never; a?: never; }; }
|
||||
>d1 : { kind: string; pos: { x: number; y: number; a?: undefined; b?: undefined; }; } | { kind: string; pos: { a: string; x?: undefined; y?: undefined; b?: undefined; } | { b: number; x?: undefined; y?: undefined; a?: undefined; }; }
|
||||
>[{ kind: 'a', pos: { x: 0, y: 0 } }, { kind: 'b', pos: !true ? { a: "x" } : { b: 0 } }][0] : { kind: string; pos: { x: number; y: number; }; } | { kind: string; pos: { a: string; } | { b: number; }; }
|
||||
>[{ kind: 'a', pos: { x: 0, y: 0 } }, { kind: 'b', pos: !true ? { a: "x" } : { b: 0 } }] : ({ kind: string; pos: { x: number; y: number; }; } | { kind: string; pos: { a: string; } | { b: number; }; })[]
|
||||
>{ kind: 'a', pos: { x: 0, y: 0 } } : { kind: string; pos: { x: number; y: number; }; }
|
||||
@@ -227,40 +227,40 @@ let d1 = [{ kind: 'a', pos: { x: 0, y: 0 } }, { kind: 'b', pos: !true ? { a: "x"
|
||||
|
||||
d1.kind;
|
||||
>d1.kind : string
|
||||
>d1 : { kind: string; pos: { x: number; y: number; a?: never; b?: never; }; } | { kind: string; pos: { a: string; x?: never; y?: never; b?: never; } | { b: number; x?: never; y?: never; a?: never; }; }
|
||||
>d1 : { kind: string; pos: { x: number; y: number; a?: undefined; b?: undefined; }; } | { kind: string; pos: { a: string; x?: undefined; y?: undefined; b?: undefined; } | { b: number; x?: undefined; y?: undefined; a?: undefined; }; }
|
||||
>kind : string
|
||||
|
||||
d1.pos;
|
||||
>d1.pos : { x: number; y: number; a?: never; b?: never; } | { a: string; x?: never; y?: never; b?: never; } | { b: number; x?: never; y?: never; a?: never; }
|
||||
>d1 : { kind: string; pos: { x: number; y: number; a?: never; b?: never; }; } | { kind: string; pos: { a: string; x?: never; y?: never; b?: never; } | { b: number; x?: never; y?: never; a?: never; }; }
|
||||
>pos : { x: number; y: number; a?: never; b?: never; } | { a: string; x?: never; y?: never; b?: never; } | { b: number; x?: never; y?: never; a?: never; }
|
||||
>d1.pos : { x: number; y: number; a?: undefined; b?: undefined; } | { a: string; x?: undefined; y?: undefined; b?: undefined; } | { b: number; x?: undefined; y?: undefined; a?: undefined; }
|
||||
>d1 : { kind: string; pos: { x: number; y: number; a?: undefined; b?: undefined; }; } | { kind: string; pos: { a: string; x?: undefined; y?: undefined; b?: undefined; } | { b: number; x?: undefined; y?: undefined; a?: undefined; }; }
|
||||
>pos : { x: number; y: number; a?: undefined; b?: undefined; } | { a: string; x?: undefined; y?: undefined; b?: undefined; } | { b: number; x?: undefined; y?: undefined; a?: undefined; }
|
||||
|
||||
d1.pos.x;
|
||||
>d1.pos.x : number | undefined
|
||||
>d1.pos : { x: number; y: number; a?: never; b?: never; } | { a: string; x?: never; y?: never; b?: never; } | { b: number; x?: never; y?: never; a?: never; }
|
||||
>d1 : { kind: string; pos: { x: number; y: number; a?: never; b?: never; }; } | { kind: string; pos: { a: string; x?: never; y?: never; b?: never; } | { b: number; x?: never; y?: never; a?: never; }; }
|
||||
>pos : { x: number; y: number; a?: never; b?: never; } | { a: string; x?: never; y?: never; b?: never; } | { b: number; x?: never; y?: never; a?: never; }
|
||||
>d1.pos : { x: number; y: number; a?: undefined; b?: undefined; } | { a: string; x?: undefined; y?: undefined; b?: undefined; } | { b: number; x?: undefined; y?: undefined; a?: undefined; }
|
||||
>d1 : { kind: string; pos: { x: number; y: number; a?: undefined; b?: undefined; }; } | { kind: string; pos: { a: string; x?: undefined; y?: undefined; b?: undefined; } | { b: number; x?: undefined; y?: undefined; a?: undefined; }; }
|
||||
>pos : { x: number; y: number; a?: undefined; b?: undefined; } | { a: string; x?: undefined; y?: undefined; b?: undefined; } | { b: number; x?: undefined; y?: undefined; a?: undefined; }
|
||||
>x : number | undefined
|
||||
|
||||
d1.pos.y;
|
||||
>d1.pos.y : number | undefined
|
||||
>d1.pos : { x: number; y: number; a?: never; b?: never; } | { a: string; x?: never; y?: never; b?: never; } | { b: number; x?: never; y?: never; a?: never; }
|
||||
>d1 : { kind: string; pos: { x: number; y: number; a?: never; b?: never; }; } | { kind: string; pos: { a: string; x?: never; y?: never; b?: never; } | { b: number; x?: never; y?: never; a?: never; }; }
|
||||
>pos : { x: number; y: number; a?: never; b?: never; } | { a: string; x?: never; y?: never; b?: never; } | { b: number; x?: never; y?: never; a?: never; }
|
||||
>d1.pos : { x: number; y: number; a?: undefined; b?: undefined; } | { a: string; x?: undefined; y?: undefined; b?: undefined; } | { b: number; x?: undefined; y?: undefined; a?: undefined; }
|
||||
>d1 : { kind: string; pos: { x: number; y: number; a?: undefined; b?: undefined; }; } | { kind: string; pos: { a: string; x?: undefined; y?: undefined; b?: undefined; } | { b: number; x?: undefined; y?: undefined; a?: undefined; }; }
|
||||
>pos : { x: number; y: number; a?: undefined; b?: undefined; } | { a: string; x?: undefined; y?: undefined; b?: undefined; } | { b: number; x?: undefined; y?: undefined; a?: undefined; }
|
||||
>y : number | undefined
|
||||
|
||||
d1.pos.a;
|
||||
>d1.pos.a : string | undefined
|
||||
>d1.pos : { x: number; y: number; a?: never; b?: never; } | { a: string; x?: never; y?: never; b?: never; } | { b: number; x?: never; y?: never; a?: never; }
|
||||
>d1 : { kind: string; pos: { x: number; y: number; a?: never; b?: never; }; } | { kind: string; pos: { a: string; x?: never; y?: never; b?: never; } | { b: number; x?: never; y?: never; a?: never; }; }
|
||||
>pos : { x: number; y: number; a?: never; b?: never; } | { a: string; x?: never; y?: never; b?: never; } | { b: number; x?: never; y?: never; a?: never; }
|
||||
>d1.pos : { x: number; y: number; a?: undefined; b?: undefined; } | { a: string; x?: undefined; y?: undefined; b?: undefined; } | { b: number; x?: undefined; y?: undefined; a?: undefined; }
|
||||
>d1 : { kind: string; pos: { x: number; y: number; a?: undefined; b?: undefined; }; } | { kind: string; pos: { a: string; x?: undefined; y?: undefined; b?: undefined; } | { b: number; x?: undefined; y?: undefined; a?: undefined; }; }
|
||||
>pos : { x: number; y: number; a?: undefined; b?: undefined; } | { a: string; x?: undefined; y?: undefined; b?: undefined; } | { b: number; x?: undefined; y?: undefined; a?: undefined; }
|
||||
>a : string | undefined
|
||||
|
||||
d1.pos.b;
|
||||
>d1.pos.b : number | undefined
|
||||
>d1.pos : { x: number; y: number; a?: never; b?: never; } | { a: string; x?: never; y?: never; b?: never; } | { b: number; x?: never; y?: never; a?: never; }
|
||||
>d1 : { kind: string; pos: { x: number; y: number; a?: never; b?: never; }; } | { kind: string; pos: { a: string; x?: never; y?: never; b?: never; } | { b: number; x?: never; y?: never; a?: never; }; }
|
||||
>pos : { x: number; y: number; a?: never; b?: never; } | { a: string; x?: never; y?: never; b?: never; } | { b: number; x?: never; y?: never; a?: never; }
|
||||
>d1.pos : { x: number; y: number; a?: undefined; b?: undefined; } | { a: string; x?: undefined; y?: undefined; b?: undefined; } | { b: number; x?: undefined; y?: undefined; a?: undefined; }
|
||||
>d1 : { kind: string; pos: { x: number; y: number; a?: undefined; b?: undefined; }; } | { kind: string; pos: { a: string; x?: undefined; y?: undefined; b?: undefined; } | { b: number; x?: undefined; y?: undefined; a?: undefined; }; }
|
||||
>pos : { x: number; y: number; a?: undefined; b?: undefined; } | { a: string; x?: undefined; y?: undefined; b?: undefined; } | { b: number; x?: undefined; y?: undefined; a?: undefined; }
|
||||
>b : number | undefined
|
||||
|
||||
declare function f<T>(...items: T[]): T;
|
||||
@@ -276,8 +276,8 @@ declare let data: { a: 1, b: "abc", c: true };
|
||||
|
||||
// Object literals are inferred as a single normalized union type
|
||||
let e1 = f({ a: 1, b: 2 }, { a: "abc" }, {});
|
||||
>e1 : { a: number; b: number; } | { a: string; b?: never; } | { a?: never; b?: never; }
|
||||
>f({ a: 1, b: 2 }, { a: "abc" }, {}) : { a: number; b: number; } | { a: string; b?: never; } | { a?: never; b?: never; }
|
||||
>e1 : { a: number; b: number; } | { a: string; b?: undefined; } | { a?: undefined; b?: undefined; }
|
||||
>f({ a: 1, b: 2 }, { a: "abc" }, {}) : { a: number; b: number; } | { a: string; b?: undefined; } | { a?: undefined; b?: undefined; }
|
||||
>f : <T>(...items: T[]) => T
|
||||
>{ a: 1, b: 2 } : { a: number; b: number; }
|
||||
>a : number
|
||||
@@ -290,8 +290,8 @@ let e1 = f({ a: 1, b: 2 }, { a: "abc" }, {});
|
||||
>{} : {}
|
||||
|
||||
let e2 = f({}, { a: "abc" }, { a: 1, b: 2 });
|
||||
>e2 : { a?: never; b?: never; } | { a: string; b?: never; } | { a: number; b: number; }
|
||||
>f({}, { a: "abc" }, { a: 1, b: 2 }) : { a?: never; b?: never; } | { a: string; b?: never; } | { a: number; b: number; }
|
||||
>e2 : { a?: undefined; b?: undefined; } | { a: string; b?: undefined; } | { a: number; b: number; }
|
||||
>f({}, { a: "abc" }, { a: 1, b: 2 }) : { a?: undefined; b?: undefined; } | { a: string; b?: undefined; } | { a: number; b: number; }
|
||||
>f : <T>(...items: T[]) => T
|
||||
>{} : {}
|
||||
>{ a: "abc" } : { a: string; }
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
=== tests/cases/conformance/types/spread/objectSpreadRepeatedComplexity.ts ===
|
||||
function f(cnd: Record<number, boolean>){
|
||||
>f : (cnd: Record<number, boolean>) => { prop20a?: number; prop20b?: number; prop19a?: number; prop19b?: number; prop18a?: number; prop18b?: number; prop17a?: number; prop17b?: number; prop16a?: number; prop16b?: number; prop15a?: number; prop15b?: number; prop14a?: number; prop14b?: number; prop13a?: number; prop13b?: number; prop12a?: number; prop12b?: number; prop11a?: number; prop11b?: number; prop10a?: number; prop10b?: number; prop9a?: number; prop9b?: number; prop8a?: number; prop8b?: number; prop7a?: number; prop7b?: number; prop6a?: number; prop6b?: number; prop5a?: number; prop5b?: number; prop4a?: number; prop4b?: number; prop3a?: number; prop3b?: number; prop0?: number; }
|
||||
>f : (cnd: Record<number, boolean>) => { prop20a?: number | undefined; prop20b?: number | undefined; prop19a?: number | undefined; prop19b?: number | undefined; prop18a?: number | undefined; prop18b?: number | undefined; prop17a?: number | undefined; prop17b?: number | undefined; prop16a?: number | undefined; prop16b?: number | undefined; prop15a?: number | undefined; prop15b?: number | undefined; prop14a?: number | undefined; prop14b?: number | undefined; prop13a?: number | undefined; prop13b?: number | undefined; prop12a?: number | undefined; prop12b?: number | undefined; prop11a?: number | undefined; prop11b?: number | undefined; prop10a?: number | undefined; prop10b?: number | undefined; prop9a?: number | undefined; prop9b?: number | undefined; prop8a?: number | undefined; prop8b?: number | undefined; prop7a?: number | undefined; prop7b?: number | undefined; prop6a?: number | undefined; prop6b?: number | undefined; prop5a?: number | undefined; prop5b?: number | undefined; prop4a?: number | undefined; prop4b?: number | undefined; prop3a?: number | undefined; prop3b?: number | undefined; prop0?: number | undefined; }
|
||||
>cnd : Record<number, boolean>
|
||||
|
||||
// Type is a union of 2^(n-1) members, where n is the number of spread objects
|
||||
return {
|
||||
>{ // Without this one, it collapses to {} ? ...(cnd[1] && cnd[2] && { prop0: 0, }), // With one prop each, it collapses to a single object (#34853?) ...(cnd[3] && { prop3a: 1, prop3b: 1, }), ...(cnd[4] && { prop4a: 1, prop4b: 1, }), ...(cnd[5] && { prop5a: 1, prop5b: 1, }), ...(cnd[6] && { prop6a: 1, prop6b: 1, }), ...(cnd[7] && { prop7a: 1, prop7b: 1, }), ...(cnd[8] && { prop8a: 1, prop8b: 1, }), ...(cnd[9] && { prop9a: 1, prop9b: 1, }), ...(cnd[10] && { prop10a: 1, prop10b: 1, }), ...(cnd[11] && { prop11a: 1, prop11b: 1, }), ...(cnd[12] && { prop12a: 1, prop12b: 1, }), ...(cnd[13] && { prop13a: 1, prop13b: 1, }), ...(cnd[14] && { prop14a: 1, prop14b: 1, }), ...(cnd[15] && { prop15a: 1, prop15b: 1, }), ...(cnd[16] && { prop16a: 1, prop16b: 1, }), ...(cnd[17] && { prop17a: 1, prop17b: 1, }), ...(cnd[18] && { prop18a: 1, prop18b: 1, }), ...(cnd[19] && { prop19a: 1, prop19b: 1, }), ...(cnd[20] && { prop20a: 1, prop20b: 1, }), } : { prop20a?: number; prop20b?: number; prop19a?: number; prop19b?: number; prop18a?: number; prop18b?: number; prop17a?: number; prop17b?: number; prop16a?: number; prop16b?: number; prop15a?: number; prop15b?: number; prop14a?: number; prop14b?: number; prop13a?: number; prop13b?: number; prop12a?: number; prop12b?: number; prop11a?: number; prop11b?: number; prop10a?: number; prop10b?: number; prop9a?: number; prop9b?: number; prop8a?: number; prop8b?: number; prop7a?: number; prop7b?: number; prop6a?: number; prop6b?: number; prop5a?: number; prop5b?: number; prop4a?: number; prop4b?: number; prop3a?: number; prop3b?: number; prop0?: number; }
|
||||
>{ // Without this one, it collapses to {} ? ...(cnd[1] && cnd[2] && { prop0: 0, }), // With one prop each, it collapses to a single object (#34853?) ...(cnd[3] && { prop3a: 1, prop3b: 1, }), ...(cnd[4] && { prop4a: 1, prop4b: 1, }), ...(cnd[5] && { prop5a: 1, prop5b: 1, }), ...(cnd[6] && { prop6a: 1, prop6b: 1, }), ...(cnd[7] && { prop7a: 1, prop7b: 1, }), ...(cnd[8] && { prop8a: 1, prop8b: 1, }), ...(cnd[9] && { prop9a: 1, prop9b: 1, }), ...(cnd[10] && { prop10a: 1, prop10b: 1, }), ...(cnd[11] && { prop11a: 1, prop11b: 1, }), ...(cnd[12] && { prop12a: 1, prop12b: 1, }), ...(cnd[13] && { prop13a: 1, prop13b: 1, }), ...(cnd[14] && { prop14a: 1, prop14b: 1, }), ...(cnd[15] && { prop15a: 1, prop15b: 1, }), ...(cnd[16] && { prop16a: 1, prop16b: 1, }), ...(cnd[17] && { prop17a: 1, prop17b: 1, }), ...(cnd[18] && { prop18a: 1, prop18b: 1, }), ...(cnd[19] && { prop19a: 1, prop19b: 1, }), ...(cnd[20] && { prop20a: 1, prop20b: 1, }), } : { prop20a?: number | undefined; prop20b?: number | undefined; prop19a?: number | undefined; prop19b?: number | undefined; prop18a?: number | undefined; prop18b?: number | undefined; prop17a?: number | undefined; prop17b?: number | undefined; prop16a?: number | undefined; prop16b?: number | undefined; prop15a?: number | undefined; prop15b?: number | undefined; prop14a?: number | undefined; prop14b?: number | undefined; prop13a?: number | undefined; prop13b?: number | undefined; prop12a?: number | undefined; prop12b?: number | undefined; prop11a?: number | undefined; prop11b?: number | undefined; prop10a?: number | undefined; prop10b?: number | undefined; prop9a?: number | undefined; prop9b?: number | undefined; prop8a?: number | undefined; prop8b?: number | undefined; prop7a?: number | undefined; prop7b?: number | undefined; prop6a?: number | undefined; prop6b?: number | undefined; prop5a?: number | undefined; prop5b?: number | undefined; prop4a?: number | undefined; prop4b?: number | undefined; prop3a?: number | undefined; prop3b?: number | undefined; prop0?: number | undefined; }
|
||||
|
||||
// Without this one, it collapses to {} ?
|
||||
...(cnd[1] &&
|
||||
|
||||
@@ -84,7 +84,7 @@ function parseWithSpread(config: Record<string, number>): Props {
|
||||
>config : Record<string, number>
|
||||
|
||||
return {
|
||||
>{ ...config.a !== undefined && { a: config.a.toString() }, ...config.b !== undefined && { b: config.b.toString() }, ...config.c !== undefined && { c: config.c.toString() }, ...config.d !== undefined && { d: config.d.toString() }, ...config.e !== undefined && { e: config.e.toString() }, ...config.f !== undefined && { f: config.f.toString() }, ...config.g !== undefined && { g: config.g.toString() }, ...config.h !== undefined && { h: config.h.toString() }, ...config.i !== undefined && { i: config.i.toString() }, ...config.j !== undefined && { j: config.j.toString() }, ...config.k !== undefined && { k: config.k.toString() }, ...config.l !== undefined && { l: config.l.toString() }, ...config.m !== undefined && { m: config.m.toString() }, ...config.n !== undefined && { n: config.n.toString() }, ...config.o !== undefined && { o: config.o.toString() }, ...config.p !== undefined && { p: config.p.toString() }, ...config.q !== undefined && { q: config.q.toString() }, ...config.r !== undefined && { r: config.r.toString() }, ...config.s !== undefined && { s: config.s.toString() }, ...config.t !== undefined && { t: config.t.toString() }, ...config.u !== undefined && { u: config.u.toString() }, ...config.v !== undefined && { v: config.v.toString() }, ...config.w !== undefined && { w: config.w.toString() }, ...config.x !== undefined && { x: config.x.toString() }, ...config.y !== undefined && { y: config.y.toString() }, ...config.z !== undefined && { z: config.z.toString() } } : { z?: string; y?: string; x?: string; w?: string; v?: string; u?: string; t?: string; s?: string; r?: string; q?: string; p?: string; o?: string; n?: string; m?: string; l?: string; k?: string; j?: string; i?: string; h?: string; g?: string; f?: string; e?: string; d?: string; c?: string; b?: string; a?: string; }
|
||||
>{ ...config.a !== undefined && { a: config.a.toString() }, ...config.b !== undefined && { b: config.b.toString() }, ...config.c !== undefined && { c: config.c.toString() }, ...config.d !== undefined && { d: config.d.toString() }, ...config.e !== undefined && { e: config.e.toString() }, ...config.f !== undefined && { f: config.f.toString() }, ...config.g !== undefined && { g: config.g.toString() }, ...config.h !== undefined && { h: config.h.toString() }, ...config.i !== undefined && { i: config.i.toString() }, ...config.j !== undefined && { j: config.j.toString() }, ...config.k !== undefined && { k: config.k.toString() }, ...config.l !== undefined && { l: config.l.toString() }, ...config.m !== undefined && { m: config.m.toString() }, ...config.n !== undefined && { n: config.n.toString() }, ...config.o !== undefined && { o: config.o.toString() }, ...config.p !== undefined && { p: config.p.toString() }, ...config.q !== undefined && { q: config.q.toString() }, ...config.r !== undefined && { r: config.r.toString() }, ...config.s !== undefined && { s: config.s.toString() }, ...config.t !== undefined && { t: config.t.toString() }, ...config.u !== undefined && { u: config.u.toString() }, ...config.v !== undefined && { v: config.v.toString() }, ...config.w !== undefined && { w: config.w.toString() }, ...config.x !== undefined && { x: config.x.toString() }, ...config.y !== undefined && { y: config.y.toString() }, ...config.z !== undefined && { z: config.z.toString() } } : { z?: string | undefined; y?: string | undefined; x?: string | undefined; w?: string | undefined; v?: string | undefined; u?: string | undefined; t?: string | undefined; s?: string | undefined; r?: string | undefined; q?: string | undefined; p?: string | undefined; o?: string | undefined; n?: string | undefined; m?: string | undefined; l?: string | undefined; k?: string | undefined; j?: string | undefined; i?: string | undefined; h?: string | undefined; g?: string | undefined; f?: string | undefined; e?: string | undefined; d?: string | undefined; c?: string | undefined; b?: string | undefined; a?: string | undefined; }
|
||||
|
||||
...config.a !== undefined && { a: config.a.toString() },
|
||||
>config.a !== undefined && { a: config.a.toString() } : false | { a: string; }
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
tests/cases/compiler/omitTypeHelperModifiers01.ts(13,5): error TS2322: Type 'undefined' is not assignable to type 'string'.
|
||||
tests/cases/compiler/omitTypeHelperModifiers01.ts(16,7): error TS2540: Cannot assign to 'c' because it is a read-only property.
|
||||
|
||||
|
||||
==== tests/cases/compiler/omitTypeHelperModifiers01.ts (2 errors) ====
|
||||
==== tests/cases/compiler/omitTypeHelperModifiers01.ts (1 errors) ====
|
||||
type A = {
|
||||
a: number;
|
||||
b?: string;
|
||||
@@ -16,8 +15,6 @@ tests/cases/compiler/omitTypeHelperModifiers01.ts(16,7): error TS2540: Cannot as
|
||||
const b = x.b;
|
||||
x.b = "hello";
|
||||
x.b = undefined;
|
||||
~~~
|
||||
!!! error TS2322: Type 'undefined' is not assignable to type 'string'.
|
||||
|
||||
const c = x.c;
|
||||
x.c = true;
|
||||
|
||||
@@ -31,16 +31,16 @@ function f(x: B) {
|
||||
|
||||
x.b = "hello";
|
||||
>x.b = "hello" : "hello"
|
||||
>x.b : string
|
||||
>x.b : string | undefined
|
||||
>x : B
|
||||
>b : string
|
||||
>b : string | undefined
|
||||
>"hello" : "hello"
|
||||
|
||||
x.b = undefined;
|
||||
>x.b = undefined : undefined
|
||||
>x.b : string
|
||||
>x.b : string | undefined
|
||||
>x : B
|
||||
>b : string
|
||||
>b : string | undefined
|
||||
>undefined : undefined
|
||||
|
||||
const c = x.c;
|
||||
|
||||
+2
-2
@@ -2,7 +2,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/optional
|
||||
Property 'k1' is incompatible with index signature.
|
||||
Type 'string | undefined' is not assignable to type 'string'.
|
||||
Type 'undefined' is not assignable to type 'string'.
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/optionalPropertyAssignableToStringIndexSignature.ts(10,1): error TS2322: Type '{ 1?: string; }' is not assignable to type '{ [key: number]: string; }'.
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/optionalPropertyAssignableToStringIndexSignature.ts(10,1): error TS2322: Type '{ 1?: string | undefined; }' is not assignable to type '{ [key: number]: string; }'.
|
||||
Property '1' is incompatible with index signature.
|
||||
Type 'string | undefined' is not assignable to type 'string'.
|
||||
Type 'undefined' is not assignable to type 'string'.
|
||||
@@ -28,7 +28,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/optional
|
||||
declare let numberLiteralKeys: { 1?: string };
|
||||
probablyArray = numberLiteralKeys; // error
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2322: Type '{ 1?: string; }' is not assignable to type '{ [key: number]: string; }'.
|
||||
!!! error TS2322: Type '{ 1?: string | undefined; }' is not assignable to type '{ [key: number]: string; }'.
|
||||
!!! error TS2322: Property '1' is incompatible with index signature.
|
||||
!!! error TS2322: Type 'string | undefined' is not assignable to type 'string'.
|
||||
!!! error TS2322: Type 'undefined' is not assignable to type 'string'.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
=== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/optionalPropertyAssignableToStringIndexSignature.ts ===
|
||||
declare let optionalProperties: { k1?: string };
|
||||
>optionalProperties : { k1?: string; }
|
||||
>optionalProperties : { k1?: string | undefined; }
|
||||
>k1 : string | undefined
|
||||
|
||||
declare let undefinedProperties: { k1: string | undefined };
|
||||
@@ -12,9 +12,9 @@ declare let stringDictionary: { [key: string]: string };
|
||||
>key : string
|
||||
|
||||
stringDictionary = optionalProperties; // ok
|
||||
>stringDictionary = optionalProperties : { k1?: string; }
|
||||
>stringDictionary = optionalProperties : { k1?: string | undefined; }
|
||||
>stringDictionary : { [key: string]: string; }
|
||||
>optionalProperties : { k1?: string; }
|
||||
>optionalProperties : { k1?: string | undefined; }
|
||||
|
||||
stringDictionary = undefinedProperties; // error
|
||||
>stringDictionary = undefinedProperties : { k1: string | undefined; }
|
||||
@@ -26,13 +26,13 @@ declare let probablyArray: { [key: number]: string };
|
||||
>key : number
|
||||
|
||||
declare let numberLiteralKeys: { 1?: string };
|
||||
>numberLiteralKeys : { 1?: string; }
|
||||
>numberLiteralKeys : { 1?: string | undefined; }
|
||||
>1 : string | undefined
|
||||
|
||||
probablyArray = numberLiteralKeys; // error
|
||||
>probablyArray = numberLiteralKeys : { 1?: string; }
|
||||
>probablyArray = numberLiteralKeys : { 1?: string | undefined; }
|
||||
>probablyArray : { [key: number]: string; }
|
||||
>numberLiteralKeys : { 1?: string; }
|
||||
>numberLiteralKeys : { 1?: string | undefined; }
|
||||
|
||||
declare let optionalUndefined: { k1?: undefined };
|
||||
>optionalUndefined : { k1?: undefined; }
|
||||
@@ -47,7 +47,7 @@ function f<T>() {
|
||||
>f : <T>() => void
|
||||
|
||||
let optional: { k1?: T } = undefined!;
|
||||
>optional : { k1?: T; }
|
||||
>optional : { k1?: T | undefined; }
|
||||
>k1 : T | undefined
|
||||
>undefined! : never
|
||||
>undefined : undefined
|
||||
@@ -55,6 +55,6 @@ function f<T>() {
|
||||
let dict: { [key: string]: T | number } = optional; // ok
|
||||
>dict : { [key: string]: number | T; }
|
||||
>key : string
|
||||
>optional : { k1?: T; }
|
||||
>optional : { k1?: T | undefined; }
|
||||
}
|
||||
|
||||
|
||||
@@ -138,9 +138,9 @@ t3 = [42, "hello"];
|
||||
>"hello" : "hello"
|
||||
|
||||
t3 = [42,,true]
|
||||
>t3 = [42,,true] : [number, never?, true?]
|
||||
>t3 = [42,,true] : [number, undefined, true]
|
||||
>t3 : T3
|
||||
>[42,,true] : [number, never?, true?]
|
||||
>[42,,true] : [number, undefined, true]
|
||||
>42 : 42
|
||||
> : undefined
|
||||
>true : true
|
||||
@@ -159,25 +159,25 @@ t4 = [42, "hello"];
|
||||
>"hello" : "hello"
|
||||
|
||||
t4 = [42,,true];
|
||||
>t4 = [42,,true] : [number, never?, true?]
|
||||
>t4 = [42,,true] : [number, undefined, true]
|
||||
>t4 : T4
|
||||
>[42,,true] : [number, never?, true?]
|
||||
>[42,,true] : [number, undefined, true]
|
||||
>42 : 42
|
||||
> : undefined
|
||||
>true : true
|
||||
|
||||
t4 = [,"hello", true];
|
||||
>t4 = [,"hello", true] : [never?, string?, true?]
|
||||
>t4 = [,"hello", true] : [undefined, string, true]
|
||||
>t4 : T4
|
||||
>[,"hello", true] : [never?, string?, true?]
|
||||
>[,"hello", true] : [undefined, string, true]
|
||||
> : undefined
|
||||
>"hello" : "hello"
|
||||
>true : true
|
||||
|
||||
t4 = [,,true];
|
||||
>t4 = [,,true] : [never?, never?, true?]
|
||||
>t4 = [,,true] : [undefined, undefined, true]
|
||||
>t4 : T4
|
||||
>[,,true] : [never?, never?, true?]
|
||||
>[,,true] : [undefined, undefined, true]
|
||||
> : undefined
|
||||
> : undefined
|
||||
>true : true
|
||||
|
||||
+16
-12
@@ -1,11 +1,13 @@
|
||||
tests/cases/compiler/paramsOnlyHaveLiteralTypesWhenAppropriatelyContextualized.ts(27,23): error TS2345: Argument of type '{ x?: number[]; y?: string[]; }' is not assignable to parameter of type '{ y?: number[]; }'.
|
||||
tests/cases/compiler/paramsOnlyHaveLiteralTypesWhenAppropriatelyContextualized.ts(27,23): error TS2345: Argument of type '{ x?: number[] | undefined; y?: string[] | undefined; }' is not assignable to parameter of type '{ y?: number[] | undefined; }'.
|
||||
Types of property 'y' are incompatible.
|
||||
Type 'string[]' is not assignable to type 'number[]'.
|
||||
Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/compiler/paramsOnlyHaveLiteralTypesWhenAppropriatelyContextualized.ts(28,23): error TS2345: Argument of type '{ x?: number[]; y?: string[]; }' is not assignable to parameter of type '{ x?: string[]; }'.
|
||||
Type 'string[] | undefined' is not assignable to type 'number[] | undefined'.
|
||||
Type 'string[]' is not assignable to type 'number[]'.
|
||||
Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/compiler/paramsOnlyHaveLiteralTypesWhenAppropriatelyContextualized.ts(28,23): error TS2345: Argument of type '{ x?: number[] | undefined; y?: string[] | undefined; }' is not assignable to parameter of type '{ x?: string[] | undefined; }'.
|
||||
Types of property 'x' are incompatible.
|
||||
Type 'number[]' is not assignable to type 'string[]'.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
Type 'number[] | undefined' is not assignable to type 'string[] | undefined'.
|
||||
Type 'number[]' is not assignable to type 'string[]'.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/paramsOnlyHaveLiteralTypesWhenAppropriatelyContextualized.ts (2 errors) ====
|
||||
@@ -37,13 +39,15 @@ tests/cases/compiler/paramsOnlyHaveLiteralTypesWhenAppropriatelyContextualized.t
|
||||
appendToOptionalArray(foo, 'y', 'bar'); // ok
|
||||
appendToOptionalArray(foo, 'y', 12); // should fail
|
||||
~~~
|
||||
!!! error TS2345: Argument of type '{ x?: number[]; y?: string[]; }' is not assignable to parameter of type '{ y?: number[]; }'.
|
||||
!!! error TS2345: Argument of type '{ x?: number[] | undefined; y?: string[] | undefined; }' is not assignable to parameter of type '{ y?: number[] | undefined; }'.
|
||||
!!! error TS2345: Types of property 'y' are incompatible.
|
||||
!!! error TS2345: Type 'string[]' is not assignable to type 'number[]'.
|
||||
!!! error TS2345: Type 'string' is not assignable to type 'number'.
|
||||
!!! error TS2345: Type 'string[] | undefined' is not assignable to type 'number[] | undefined'.
|
||||
!!! error TS2345: Type 'string[]' is not assignable to type 'number[]'.
|
||||
!!! error TS2345: Type 'string' is not assignable to type 'number'.
|
||||
appendToOptionalArray(foo, 'x', "no"); // should fail
|
||||
~~~
|
||||
!!! error TS2345: Argument of type '{ x?: number[]; y?: string[]; }' is not assignable to parameter of type '{ x?: string[]; }'.
|
||||
!!! error TS2345: Argument of type '{ x?: number[] | undefined; y?: string[] | undefined; }' is not assignable to parameter of type '{ x?: string[] | undefined; }'.
|
||||
!!! error TS2345: Types of property 'x' are incompatible.
|
||||
!!! error TS2345: Type 'number[]' is not assignable to type 'string[]'.
|
||||
!!! error TS2345: Type 'number' is not assignable to type 'string'.
|
||||
!!! error TS2345: Type 'number[] | undefined' is not assignable to type 'string[] | undefined'.
|
||||
!!! error TS2345: Type 'number[]' is not assignable to type 'string[]'.
|
||||
!!! error TS2345: Type 'number' is not assignable to type 'string'.
|
||||
+17
-17
@@ -7,13 +7,13 @@ type Lower<T> = { [K in keyof T]: T[K] };
|
||||
>Lower : Lower<T>
|
||||
|
||||
export function appendToOptionalArray<
|
||||
>appendToOptionalArray : <K extends string | number | symbol, T>(object: { [x in K]?: Lower<T>[]; }, key: K, value: T) => void
|
||||
>appendToOptionalArray : <K extends string | number | symbol, T>(object: { [x in K]?: Lower<T>[] | undefined; }, key: K, value: T) => void
|
||||
|
||||
K extends string | number | symbol,
|
||||
T
|
||||
>(
|
||||
object: { [x in K]?: Lower<T>[] },
|
||||
>object : { [x in K]?: Lower<T>[]; }
|
||||
>object : { [x in K]?: Lower<T>[] | undefined; }
|
||||
|
||||
key: K,
|
||||
>key : K
|
||||
@@ -23,13 +23,13 @@ export function appendToOptionalArray<
|
||||
|
||||
) {
|
||||
const array = object[key];
|
||||
>array : { [x in K]?: Lower<T>[]; }[K]
|
||||
>object[key] : { [x in K]?: Lower<T>[]; }[K]
|
||||
>object : { [x in K]?: Lower<T>[]; }
|
||||
>array : { [x in K]?: Lower<T>[] | undefined; }[K]
|
||||
>object[key] : { [x in K]?: Lower<T>[] | undefined; }[K]
|
||||
>object : { [x in K]?: Lower<T>[] | undefined; }
|
||||
>key : K
|
||||
|
||||
if (array) {
|
||||
>array : { [x in K]?: Lower<T>[]; }[K]
|
||||
>array : { [x in K]?: Lower<T>[] | undefined; }[K]
|
||||
|
||||
array.push(value);
|
||||
>array.push(value) : number
|
||||
@@ -41,8 +41,8 @@ export function appendToOptionalArray<
|
||||
} else {
|
||||
object[key] = [value];
|
||||
>object[key] = [value] : T[]
|
||||
>object[key] : { [x in K]?: Lower<T>[]; }[K]
|
||||
>object : { [x in K]?: Lower<T>[]; }
|
||||
>object[key] : { [x in K]?: Lower<T>[] | undefined; }[K]
|
||||
>object : { [x in K]?: Lower<T>[] | undefined; }
|
||||
>key : K
|
||||
>[value] : T[]
|
||||
>value : T
|
||||
@@ -51,36 +51,36 @@ export function appendToOptionalArray<
|
||||
|
||||
// e.g.
|
||||
const foo: {x?: number[]; y?: string[]; } = {};
|
||||
>foo : { x?: number[]; y?: string[]; }
|
||||
>foo : { x?: number[] | undefined; y?: string[] | undefined; }
|
||||
>x : number[] | undefined
|
||||
>y : string[] | undefined
|
||||
>{} : {}
|
||||
|
||||
appendToOptionalArray(foo, 'x', 123); // ok
|
||||
>appendToOptionalArray(foo, 'x', 123) : void
|
||||
>appendToOptionalArray : <K extends string | number | symbol, T>(object: { [x in K]?: Lower<T>[]; }, key: K, value: T) => void
|
||||
>foo : { x?: number[]; y?: string[]; }
|
||||
>appendToOptionalArray : <K extends string | number | symbol, T>(object: { [x in K]?: Lower<T>[] | undefined; }, key: K, value: T) => void
|
||||
>foo : { x?: number[] | undefined; y?: string[] | undefined; }
|
||||
>'x' : "x"
|
||||
>123 : 123
|
||||
|
||||
appendToOptionalArray(foo, 'y', 'bar'); // ok
|
||||
>appendToOptionalArray(foo, 'y', 'bar') : void
|
||||
>appendToOptionalArray : <K extends string | number | symbol, T>(object: { [x in K]?: Lower<T>[]; }, key: K, value: T) => void
|
||||
>foo : { x?: number[]; y?: string[]; }
|
||||
>appendToOptionalArray : <K extends string | number | symbol, T>(object: { [x in K]?: Lower<T>[] | undefined; }, key: K, value: T) => void
|
||||
>foo : { x?: number[] | undefined; y?: string[] | undefined; }
|
||||
>'y' : "y"
|
||||
>'bar' : "bar"
|
||||
|
||||
appendToOptionalArray(foo, 'y', 12); // should fail
|
||||
>appendToOptionalArray(foo, 'y', 12) : void
|
||||
>appendToOptionalArray : <K extends string | number | symbol, T>(object: { [x in K]?: Lower<T>[]; }, key: K, value: T) => void
|
||||
>foo : { x?: number[]; y?: string[]; }
|
||||
>appendToOptionalArray : <K extends string | number | symbol, T>(object: { [x in K]?: Lower<T>[] | undefined; }, key: K, value: T) => void
|
||||
>foo : { x?: number[] | undefined; y?: string[] | undefined; }
|
||||
>'y' : "y"
|
||||
>12 : 12
|
||||
|
||||
appendToOptionalArray(foo, 'x', "no"); // should fail
|
||||
>appendToOptionalArray(foo, 'x', "no") : void
|
||||
>appendToOptionalArray : <K extends string | number | symbol, T>(object: { [x in K]?: Lower<T>[]; }, key: K, value: T) => void
|
||||
>foo : { x?: number[]; y?: string[]; }
|
||||
>appendToOptionalArray : <K extends string | number | symbol, T>(object: { [x in K]?: Lower<T>[] | undefined; }, key: K, value: T) => void
|
||||
>foo : { x?: number[] | undefined; y?: string[] | undefined; }
|
||||
>'x' : "x"
|
||||
>"no" : "no"
|
||||
|
||||
|
||||
@@ -91,7 +91,7 @@ interface Props {
|
||||
>bool : boolean
|
||||
|
||||
shape: {
|
||||
>shape : { foo: string; bar?: boolean; baz?: any; }
|
||||
>shape : { foo: string; bar?: boolean | undefined; baz?: any; }
|
||||
|
||||
foo: string;
|
||||
>foo : string
|
||||
@@ -104,7 +104,7 @@ interface Props {
|
||||
|
||||
};
|
||||
oneOfType: string | boolean | {
|
||||
>oneOfType : string | boolean | { foo?: string; bar: number; }
|
||||
>oneOfType : string | boolean | { foo?: string | undefined; bar: number; }
|
||||
|
||||
foo?: string;
|
||||
>foo : string | undefined
|
||||
|
||||
@@ -33,39 +33,39 @@ o3.b?.c;
|
||||
>c : string | undefined
|
||||
|
||||
declare const o4: { b?: { c: { d?: { e: string } } } };
|
||||
>o4 : { b?: { c: { d?: { e: string; }; };}; }
|
||||
>o4 : { b?: { c: { d?: { e: string; };}; } | undefined; }
|
||||
>b : { c: { d?: { e: string; };}; } | undefined
|
||||
>c : { d?: { e: string;}; }
|
||||
>c : { d?: { e: string; } | undefined; }
|
||||
>d : { e: string; } | undefined
|
||||
>e : string
|
||||
|
||||
o4.b?.c.d?.e;
|
||||
>o4.b?.c.d?.e : string | undefined
|
||||
>o4.b?.c.d : { e: string; } | undefined
|
||||
>o4.b?.c : { d?: { e: string; }; } | undefined
|
||||
>o4.b : { c: { d?: { e: string; }; }; } | undefined
|
||||
>o4 : { b?: { c: { d?: { e: string; }; }; }; }
|
||||
>b : { c: { d?: { e: string; }; }; } | undefined
|
||||
>c : { d?: { e: string; }; } | undefined
|
||||
>o4.b?.c : { d?: { e: string; } | undefined; } | undefined
|
||||
>o4.b : { c: { d?: { e: string; } | undefined; }; } | undefined
|
||||
>o4 : { b?: { c: { d?: { e: string; } | undefined; }; } | undefined; }
|
||||
>b : { c: { d?: { e: string; } | undefined; }; } | undefined
|
||||
>c : { d?: { e: string; } | undefined; } | undefined
|
||||
>d : { e: string; } | undefined
|
||||
>e : string | undefined
|
||||
|
||||
declare const o5: { b?(): { c: { d?: { e: string } } } };
|
||||
>o5 : { b?(): { c: { d?: { e: string; }; };}; }
|
||||
>b : (() => { c: { d?: { e: string; }; };}) | undefined
|
||||
>c : { d?: { e: string;}; }
|
||||
>c : { d?: { e: string; } | undefined; }
|
||||
>d : { e: string; } | undefined
|
||||
>e : string
|
||||
|
||||
o5.b?.().c.d?.e;
|
||||
>o5.b?.().c.d?.e : string | undefined
|
||||
>o5.b?.().c.d : { e: string; } | undefined
|
||||
>o5.b?.().c : { d?: { e: string; }; } | undefined
|
||||
>o5.b?.() : { c: { d?: { e: string; }; }; } | undefined
|
||||
>o5.b : (() => { c: { d?: { e: string; }; }; }) | undefined
|
||||
>o5 : { b?(): { c: { d?: { e: string; }; }; }; }
|
||||
>b : (() => { c: { d?: { e: string; }; }; }) | undefined
|
||||
>c : { d?: { e: string; }; } | undefined
|
||||
>o5.b?.().c : { d?: { e: string; } | undefined; } | undefined
|
||||
>o5.b?.() : { c: { d?: { e: string; } | undefined; }; } | undefined
|
||||
>o5.b : (() => { c: { d?: { e: string; } | undefined; }; }) | undefined
|
||||
>o5 : { b?(): { c: { d?: { e: string; } | undefined; }; }; }
|
||||
>b : (() => { c: { d?: { e: string; } | undefined; }; }) | undefined
|
||||
>c : { d?: { e: string; } | undefined; } | undefined
|
||||
>d : { e: string; } | undefined
|
||||
>e : string | undefined
|
||||
|
||||
|
||||
@@ -1,24 +1,23 @@
|
||||
tests/cases/compiler/reactDefaultPropsInferenceSuccess.tsx(27,36): error TS2769: No overload matches this call.
|
||||
Overload 1 of 2, '(props: Readonly<Props>): FieldFeedback<Props>', gave the following error.
|
||||
Type '(value: string) => void' is not assignable to type '"a" | "b" | ((value: string) => boolean)'.
|
||||
Type '(value: string) => void' is not assignable to type '"a" | "b" | ((value: string) => boolean) | undefined'.
|
||||
Type '(value: string) => void' is not assignable to type '(value: string) => boolean'.
|
||||
Type 'void' is not assignable to type 'boolean'.
|
||||
Overload 2 of 2, '(props: Props, context?: any): FieldFeedback<Props>', gave the following error.
|
||||
Type '(value: string) => void' is not assignable to type '"a" | "b" | ((value: string) => boolean)'.
|
||||
Type '(value: string) => void' is not assignable to type '(value: string) => boolean'.
|
||||
Type '(value: string) => void' is not assignable to type '"a" | "b" | ((value: string) => boolean) | undefined'.
|
||||
tests/cases/compiler/reactDefaultPropsInferenceSuccess.tsx(43,41): error TS2769: No overload matches this call.
|
||||
Overload 1 of 2, '(props: Readonly<Props>): FieldFeedbackBeta<Props>', gave the following error.
|
||||
Type '(value: string) => void' is not assignable to type '"a" | "b" | ((value: string) => boolean)'.
|
||||
Type '(value: string) => void' is not assignable to type '"a" | "b" | ((value: string) => boolean) | undefined'.
|
||||
Type '(value: string) => void' is not assignable to type '(value: string) => boolean'.
|
||||
Type 'void' is not assignable to type 'boolean'.
|
||||
Overload 2 of 2, '(props: Props, context?: any): FieldFeedbackBeta<Props>', gave the following error.
|
||||
Type '(value: string) => void' is not assignable to type '"a" | "b" | ((value: string) => boolean)'.
|
||||
Type '(value: string) => void' is not assignable to type '(value: string) => boolean'.
|
||||
tests/cases/compiler/reactDefaultPropsInferenceSuccess.tsx(64,52): error TS2769: No overload matches this call.
|
||||
Type '(value: string) => void' is not assignable to type '"a" | "b" | ((value: string) => boolean) | undefined'.
|
||||
tests/cases/compiler/reactDefaultPropsInferenceSuccess.tsx(64,37): error TS2769: No overload matches this call.
|
||||
Overload 1 of 2, '(props: Readonly<MyPropsProps>): FieldFeedback2<MyPropsProps>', gave the following error.
|
||||
Type 'void' is not assignable to type 'boolean'.
|
||||
Type '(value: string) => void' is not assignable to type '(value: string) => boolean'.
|
||||
Type 'void' is not assignable to type 'boolean'.
|
||||
Overload 2 of 2, '(props: MyPropsProps, context?: any): FieldFeedback2<MyPropsProps>', gave the following error.
|
||||
Type 'void' is not assignable to type 'boolean'.
|
||||
Type '(value: string) => void' is not assignable to type '(value: string) => boolean'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/reactDefaultPropsInferenceSuccess.tsx (3 errors) ====
|
||||
@@ -52,12 +51,11 @@ tests/cases/compiler/reactDefaultPropsInferenceSuccess.tsx(64,52): error TS2769:
|
||||
~~~~
|
||||
!!! error TS2769: No overload matches this call.
|
||||
!!! error TS2769: Overload 1 of 2, '(props: Readonly<Props>): FieldFeedback<Props>', gave the following error.
|
||||
!!! error TS2769: Type '(value: string) => void' is not assignable to type '"a" | "b" | ((value: string) => boolean)'.
|
||||
!!! error TS2769: Type '(value: string) => void' is not assignable to type '"a" | "b" | ((value: string) => boolean) | undefined'.
|
||||
!!! error TS2769: Type '(value: string) => void' is not assignable to type '(value: string) => boolean'.
|
||||
!!! error TS2769: Type 'void' is not assignable to type 'boolean'.
|
||||
!!! error TS2769: Overload 2 of 2, '(props: Props, context?: any): FieldFeedback<Props>', gave the following error.
|
||||
!!! error TS2769: Type '(value: string) => void' is not assignable to type '"a" | "b" | ((value: string) => boolean)'.
|
||||
!!! error TS2769: Type '(value: string) => void' is not assignable to type '(value: string) => boolean'.
|
||||
!!! error TS2769: Type '(value: string) => void' is not assignable to type '"a" | "b" | ((value: string) => boolean) | undefined'.
|
||||
!!! related TS6500 tests/cases/compiler/reactDefaultPropsInferenceSuccess.tsx:6:3: The expected type comes from property 'when' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes<FieldFeedback<Props>> & Pick<Readonly<{ children?: ReactNode; }> & Readonly<Props>, "children" | "error"> & Partial<Pick<Readonly<{ children?: ReactNode; }> & Readonly<Props>, "when">> & Partial<Pick<{ when: () => boolean; }, never>>'
|
||||
!!! related TS6500 tests/cases/compiler/reactDefaultPropsInferenceSuccess.tsx:6:3: The expected type comes from property 'when' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes<FieldFeedback<Props>> & Pick<Readonly<{ children?: ReactNode; }> & Readonly<Props>, "children" | "error"> & Partial<Pick<Readonly<{ children?: ReactNode; }> & Readonly<Props>, "when">> & Partial<Pick<{ when: () => boolean; }, never>>'
|
||||
|
||||
@@ -79,12 +77,11 @@ tests/cases/compiler/reactDefaultPropsInferenceSuccess.tsx(64,52): error TS2769:
|
||||
~~~~
|
||||
!!! error TS2769: No overload matches this call.
|
||||
!!! error TS2769: Overload 1 of 2, '(props: Readonly<Props>): FieldFeedbackBeta<Props>', gave the following error.
|
||||
!!! error TS2769: Type '(value: string) => void' is not assignable to type '"a" | "b" | ((value: string) => boolean)'.
|
||||
!!! error TS2769: Type '(value: string) => void' is not assignable to type '"a" | "b" | ((value: string) => boolean) | undefined'.
|
||||
!!! error TS2769: Type '(value: string) => void' is not assignable to type '(value: string) => boolean'.
|
||||
!!! error TS2769: Type 'void' is not assignable to type 'boolean'.
|
||||
!!! error TS2769: Overload 2 of 2, '(props: Props, context?: any): FieldFeedbackBeta<Props>', gave the following error.
|
||||
!!! error TS2769: Type '(value: string) => void' is not assignable to type '"a" | "b" | ((value: string) => boolean)'.
|
||||
!!! error TS2769: Type '(value: string) => void' is not assignable to type '(value: string) => boolean'.
|
||||
!!! error TS2769: Type '(value: string) => void' is not assignable to type '"a" | "b" | ((value: string) => boolean) | undefined'.
|
||||
!!! related TS6500 tests/cases/compiler/reactDefaultPropsInferenceSuccess.tsx:6:3: The expected type comes from property 'when' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes<FieldFeedbackBeta<Props>> & Pick<Readonly<{ children?: ReactNode; }> & Readonly<Props>, "children"> & Partial<Pick<Readonly<{ children?: ReactNode; }> & Readonly<Props>, keyof Props>> & Partial<Pick<BaseProps, never>>'
|
||||
!!! related TS6500 tests/cases/compiler/reactDefaultPropsInferenceSuccess.tsx:6:3: The expected type comes from property 'when' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes<FieldFeedbackBeta<Props>> & Pick<Readonly<{ children?: ReactNode; }> & Readonly<Props>, "children"> & Partial<Pick<Readonly<{ children?: ReactNode; }> & Readonly<Props>, keyof Props>> & Partial<Pick<BaseProps, never>>'
|
||||
|
||||
@@ -108,14 +105,15 @@ tests/cases/compiler/reactDefaultPropsInferenceSuccess.tsx(64,52): error TS2769:
|
||||
|
||||
// Error: Void not assignable to boolean
|
||||
const Test4 = () => <FieldFeedback2 when={value => console.log(value)} />;
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
~~~~
|
||||
!!! error TS2769: No overload matches this call.
|
||||
!!! error TS2769: Overload 1 of 2, '(props: Readonly<MyPropsProps>): FieldFeedback2<MyPropsProps>', gave the following error.
|
||||
!!! error TS2769: Type 'void' is not assignable to type 'boolean'.
|
||||
!!! error TS2769: Type '(value: string) => void' is not assignable to type '(value: string) => boolean'.
|
||||
!!! error TS2769: Type 'void' is not assignable to type 'boolean'.
|
||||
!!! error TS2769: Overload 2 of 2, '(props: MyPropsProps, context?: any): FieldFeedback2<MyPropsProps>', gave the following error.
|
||||
!!! error TS2769: Type 'void' is not assignable to type 'boolean'.
|
||||
!!! related TS6502 tests/cases/compiler/reactDefaultPropsInferenceSuccess.tsx:46:9: The expected type comes from the return type of this signature.
|
||||
!!! related TS6502 tests/cases/compiler/reactDefaultPropsInferenceSuccess.tsx:46:9: The expected type comes from the return type of this signature.
|
||||
!!! error TS2769: Type '(value: string) => void' is not assignable to type '(value: string) => boolean'.
|
||||
!!! related TS6500 tests/cases/compiler/reactDefaultPropsInferenceSuccess.tsx:46:3: The expected type comes from property 'when' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes<FieldFeedback2<MyPropsProps>> & Pick<Readonly<{ children?: ReactNode; }> & Readonly<MyPropsProps>, "children" | "error"> & Partial<Pick<Readonly<{ children?: ReactNode; }> & Readonly<MyPropsProps>, "when">> & Partial<Pick<{ when: () => boolean; }, never>>'
|
||||
!!! related TS6500 tests/cases/compiler/reactDefaultPropsInferenceSuccess.tsx:46:3: The expected type comes from property 'when' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes<FieldFeedback2<MyPropsProps>> & Pick<Readonly<{ children?: ReactNode; }> & Readonly<MyPropsProps>, "children" | "error"> & Partial<Pick<Readonly<{ children?: ReactNode; }> & Readonly<MyPropsProps>, "when">> & Partial<Pick<{ when: () => boolean; }, never>>'
|
||||
|
||||
// OK
|
||||
const Test5 = () => <FieldFeedback2 />;
|
||||
|
||||
@@ -10,7 +10,7 @@ declare class Component<P> {
|
||||
>context : any
|
||||
|
||||
readonly props: Readonly<P> & Readonly<{ children?: {} }>;
|
||||
>props : Readonly<P> & Readonly<{ children?: {}; }>
|
||||
>props : Readonly<P> & Readonly<{ children?: {} | undefined; }>
|
||||
>children : {} | undefined
|
||||
}
|
||||
interface ComponentClass<P = {}> {
|
||||
@@ -29,7 +29,7 @@ interface ComponentClass<P = {}> {
|
||||
}
|
||||
interface FunctionComponent<P = {}> {
|
||||
(props: P & { children?: {} }, context?: any): {} | null;
|
||||
>props : P & { children?: {}; }
|
||||
>props : P & { children?: {} | undefined; }
|
||||
>children : {} | undefined
|
||||
>context : any
|
||||
>null : null
|
||||
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"exactOptionalPropertyTypes": true
|
||||
}
|
||||
}
|
||||
@@ -17,12 +17,12 @@ interface Animal {
|
||||
}
|
||||
|
||||
function clonePet(pet: Animal, fullCopy?: boolean) {
|
||||
>clonePet : (pet: Animal, fullCopy?: boolean | undefined) => { name: string; kind: string; age?: number; location?: string; owner?: object; }
|
||||
>clonePet : (pet: Animal, fullCopy?: boolean | undefined) => { name: string; kind: string; age?: number | undefined; location?: string | undefined; owner?: object | undefined; }
|
||||
>pet : Animal
|
||||
>fullCopy : boolean | undefined
|
||||
|
||||
return {
|
||||
>{ name: pet.name, kind: pet.kind, ...(fullCopy && pet), } : { name: string; kind: string; age?: number; location?: string; owner?: object; }
|
||||
>{ name: pet.name, kind: pet.kind, ...(fullCopy && pet), } : { name: string; kind: string; age?: number | undefined; location?: string | undefined; owner?: object | undefined; }
|
||||
|
||||
name: pet.name,
|
||||
>name : string
|
||||
@@ -52,11 +52,11 @@ interface Animal2 {
|
||||
>owner : string | undefined
|
||||
}
|
||||
function billOwner(pet: Animal2) {
|
||||
>billOwner : (pet: Animal2) => { paid: boolean; name?: string; owner?: string; }
|
||||
>billOwner : (pet: Animal2) => { paid: boolean; name?: string | undefined; owner?: string | undefined; }
|
||||
>pet : Animal2
|
||||
|
||||
return {
|
||||
>{ ...(pet.owner && pet), paid: false } : { paid: boolean; name?: string; owner?: string; }
|
||||
>{ ...(pet.owner && pet), paid: false } : { paid: boolean; name?: string | undefined; owner?: string | undefined; }
|
||||
|
||||
...(pet.owner && pet),
|
||||
>(pet.owner && pet) : "" | Animal2 | undefined
|
||||
|
||||
@@ -9,11 +9,11 @@ const recordOfRecords: RecordOfRecords = {}
|
||||
>{} : {}
|
||||
|
||||
recordOfRecords.propA = {...(foo !== undefined ? {foo} : {})} // OK
|
||||
>recordOfRecords.propA = {...(foo !== undefined ? {foo} : {})} : { foo?: Record<never, never>; }
|
||||
>recordOfRecords.propA = {...(foo !== undefined ? {foo} : {})} : { foo?: Record<never, never> | undefined; }
|
||||
>recordOfRecords.propA : RecordOfRecords
|
||||
>recordOfRecords : RecordOfRecords
|
||||
>propA : RecordOfRecords
|
||||
>{...(foo !== undefined ? {foo} : {})} : { foo?: Record<never, never>; }
|
||||
>{...(foo !== undefined ? {foo} : {})} : { foo?: Record<never, never> | undefined; }
|
||||
>(foo !== undefined ? {foo} : {}) : { foo: Record<never, never>; } | {}
|
||||
>foo !== undefined ? {foo} : {} : { foo: Record<never, never>; } | {}
|
||||
>foo !== undefined : boolean
|
||||
@@ -36,11 +36,11 @@ recordOfRecords.propB = {...(foo && {foo})} // OK
|
||||
>foo : Record<never, never>
|
||||
|
||||
recordOfRecords.propC = {...(foo !== undefined && {foo})} // error'd in 3.7 beta, should be OK
|
||||
>recordOfRecords.propC = {...(foo !== undefined && {foo})} : { foo?: Record<never, never>; }
|
||||
>recordOfRecords.propC = {...(foo !== undefined && {foo})} : { foo?: Record<never, never> | undefined; }
|
||||
>recordOfRecords.propC : RecordOfRecords
|
||||
>recordOfRecords : RecordOfRecords
|
||||
>propC : RecordOfRecords
|
||||
>{...(foo !== undefined && {foo})} : { foo?: Record<never, never>; }
|
||||
>{...(foo !== undefined && {foo})} : { foo?: Record<never, never> | undefined; }
|
||||
>(foo !== undefined && {foo}) : false | { foo: Record<never, never>; }
|
||||
>foo !== undefined && {foo} : false | { foo: Record<never, never>; }
|
||||
>foo !== undefined : boolean
|
||||
@@ -55,11 +55,11 @@ const recordsOfRecordsOrEmpty: RecordOfRecordsOrEmpty = {}
|
||||
>{} : {}
|
||||
|
||||
recordsOfRecordsOrEmpty.propA = {...(foo !== undefined ? {foo} : {})} // OK
|
||||
>recordsOfRecordsOrEmpty.propA = {...(foo !== undefined ? {foo} : {})} : { foo?: Record<never, never>; }
|
||||
>recordsOfRecordsOrEmpty.propA = {...(foo !== undefined ? {foo} : {})} : { foo?: Record<never, never> | undefined; }
|
||||
>recordsOfRecordsOrEmpty.propA : {} | RecordOfRecordsOrEmpty
|
||||
>recordsOfRecordsOrEmpty : RecordOfRecordsOrEmpty
|
||||
>propA : {} | RecordOfRecordsOrEmpty
|
||||
>{...(foo !== undefined ? {foo} : {})} : { foo?: Record<never, never>; }
|
||||
>{...(foo !== undefined ? {foo} : {})} : { foo?: Record<never, never> | undefined; }
|
||||
>(foo !== undefined ? {foo} : {}) : { foo: Record<never, never>; } | {}
|
||||
>foo !== undefined ? {foo} : {} : { foo: Record<never, never>; } | {}
|
||||
>foo !== undefined : boolean
|
||||
@@ -82,11 +82,11 @@ recordsOfRecordsOrEmpty.propB = {...(foo && {foo})} // OK
|
||||
>foo : Record<never, never>
|
||||
|
||||
recordsOfRecordsOrEmpty.propC = {...(foo !== undefined && {foo})} // OK
|
||||
>recordsOfRecordsOrEmpty.propC = {...(foo !== undefined && {foo})} : { foo?: Record<never, never>; }
|
||||
>recordsOfRecordsOrEmpty.propC = {...(foo !== undefined && {foo})} : { foo?: Record<never, never> | undefined; }
|
||||
>recordsOfRecordsOrEmpty.propC : {} | RecordOfRecordsOrEmpty
|
||||
>recordsOfRecordsOrEmpty : RecordOfRecordsOrEmpty
|
||||
>propC : {} | RecordOfRecordsOrEmpty
|
||||
>{...(foo !== undefined && {foo})} : { foo?: Record<never, never>; }
|
||||
>{...(foo !== undefined && {foo})} : { foo?: Record<never, never> | undefined; }
|
||||
>(foo !== undefined && {foo}) : false | { foo: Record<never, never>; }
|
||||
>foo !== undefined && {foo} : false | { foo: Record<never, never>; }
|
||||
>foo !== undefined : boolean
|
||||
|
||||
@@ -5,7 +5,7 @@ declare var ab: { a: number, b: number };
|
||||
>b : number
|
||||
|
||||
declare var abq: { a: number, b?: number };
|
||||
>abq : { a: number; b?: number; }
|
||||
>abq : { a: number; b?: number | undefined; }
|
||||
>a : number
|
||||
>b : number | undefined
|
||||
|
||||
@@ -27,7 +27,7 @@ var unused3 = { b: 1, ...abq } // ok, abq might have b: undefined
|
||||
>{ b: 1, ...abq } : { a: number; b: number; }
|
||||
>b : number
|
||||
>1 : 1
|
||||
>abq : { a: number; b?: number; }
|
||||
>abq : { a: number; b?: number | undefined; }
|
||||
|
||||
var unused4 = { ...ab, b: 1 } // ok, we don't care that b in ab is overwritten
|
||||
>unused4 : { b: number; a: number; }
|
||||
@@ -39,7 +39,7 @@ var unused4 = { ...ab, b: 1 } // ok, we don't care that b in ab is overwritten
|
||||
var unused5 = { ...abq, b: 1 } // ok
|
||||
>unused5 : { b: number; a: number; }
|
||||
>{ ...abq, b: 1 } : { b: number; a: number; }
|
||||
>abq : { a: number; b?: number; }
|
||||
>abq : { a: number; b?: number | undefined; }
|
||||
>b : number
|
||||
>1 : 1
|
||||
|
||||
@@ -78,14 +78,14 @@ function h(obj: { x: number } | { x: string }) {
|
||||
>obj : { x: number; } | { x: string; }
|
||||
}
|
||||
function i(b: boolean, t: { command: string, ok: string }) {
|
||||
>i : (b: boolean, t: { command: string; ok: string;}) => { command: string; ok?: string; }
|
||||
>i : (b: boolean, t: { command: string; ok: string;}) => { command: string; ok?: string | undefined; }
|
||||
>b : boolean
|
||||
>t : { command: string; ok: string; }
|
||||
>command : string
|
||||
>ok : string
|
||||
|
||||
return { command: "hi", ...(b ? t : {}) } // ok
|
||||
>{ command: "hi", ...(b ? t : {}) } : { command: string; ok?: string; }
|
||||
>{ command: "hi", ...(b ? t : {}) } : { command: string; ok?: string | undefined; }
|
||||
>command : string
|
||||
>"hi" : "hi"
|
||||
>(b ? t : {}) : { command: string; ok: string; } | {}
|
||||
|
||||
@@ -79,12 +79,12 @@
|
||||
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
|
||||
// "strictBindCallApply": true, /* Check that the arguments for `bind`, `call`, and `apply` methods match the original function. */
|
||||
// "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
|
||||
// "strictOptionalProperties": true, /* Enable strict checking of optional properties. */
|
||||
// "noImplicitThis": true, /* Enable error reporting when `this` is given the type `any`. */
|
||||
// "useUnknownInCatchVariables": true, /* Type catch clause variables as 'unknown' instead of 'any'. */
|
||||
// "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
|
||||
// "noUnusedLocals": true, /* Enable error reporting when a local variables aren't read. */
|
||||
// "noUnusedParameters": true, /* Raise an error when a function parameter isn't read */
|
||||
// "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
|
||||
// "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
|
||||
// "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
|
||||
// "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */
|
||||
|
||||
+1
-1
@@ -79,12 +79,12 @@
|
||||
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
|
||||
// "strictBindCallApply": true, /* Check that the arguments for `bind`, `call`, and `apply` methods match the original function. */
|
||||
// "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
|
||||
// "strictOptionalProperties": true, /* Enable strict checking of optional properties. */
|
||||
// "noImplicitThis": true, /* Enable error reporting when `this` is given the type `any`. */
|
||||
// "useUnknownInCatchVariables": true, /* Type catch clause variables as 'unknown' instead of 'any'. */
|
||||
// "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
|
||||
// "noUnusedLocals": true, /* Enable error reporting when a local variables aren't read. */
|
||||
// "noUnusedParameters": true, /* Raise an error when a function parameter isn't read */
|
||||
// "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
|
||||
// "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
|
||||
// "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
|
||||
// "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */
|
||||
|
||||
+1
-1
@@ -79,12 +79,12 @@
|
||||
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
|
||||
// "strictBindCallApply": true, /* Check that the arguments for `bind`, `call`, and `apply` methods match the original function. */
|
||||
// "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
|
||||
// "strictOptionalProperties": true, /* Enable strict checking of optional properties. */
|
||||
// "noImplicitThis": true, /* Enable error reporting when `this` is given the type `any`. */
|
||||
// "useUnknownInCatchVariables": true, /* Type catch clause variables as 'unknown' instead of 'any'. */
|
||||
// "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
|
||||
"noUnusedLocals": true, /* Enable error reporting when a local variables aren't read. */
|
||||
// "noUnusedParameters": true, /* Raise an error when a function parameter isn't read */
|
||||
// "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
|
||||
// "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
|
||||
// "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
|
||||
// "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */
|
||||
|
||||
+1
-1
@@ -79,12 +79,12 @@
|
||||
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
|
||||
// "strictBindCallApply": true, /* Check that the arguments for `bind`, `call`, and `apply` methods match the original function. */
|
||||
// "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
|
||||
// "strictOptionalProperties": true, /* Enable strict checking of optional properties. */
|
||||
// "noImplicitThis": true, /* Enable error reporting when `this` is given the type `any`. */
|
||||
// "useUnknownInCatchVariables": true, /* Type catch clause variables as 'unknown' instead of 'any'. */
|
||||
// "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
|
||||
// "noUnusedLocals": true, /* Enable error reporting when a local variables aren't read. */
|
||||
// "noUnusedParameters": true, /* Raise an error when a function parameter isn't read */
|
||||
// "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
|
||||
// "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
|
||||
// "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
|
||||
// "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */
|
||||
|
||||
+1
-1
@@ -79,12 +79,12 @@
|
||||
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
|
||||
// "strictBindCallApply": true, /* Check that the arguments for `bind`, `call`, and `apply` methods match the original function. */
|
||||
// "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
|
||||
// "strictOptionalProperties": true, /* Enable strict checking of optional properties. */
|
||||
// "noImplicitThis": true, /* Enable error reporting when `this` is given the type `any`. */
|
||||
// "useUnknownInCatchVariables": true, /* Type catch clause variables as 'unknown' instead of 'any'. */
|
||||
// "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
|
||||
// "noUnusedLocals": true, /* Enable error reporting when a local variables aren't read. */
|
||||
// "noUnusedParameters": true, /* Raise an error when a function parameter isn't read */
|
||||
// "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
|
||||
// "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
|
||||
// "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
|
||||
// "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */
|
||||
|
||||
+1
-1
@@ -79,12 +79,12 @@
|
||||
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
|
||||
// "strictBindCallApply": true, /* Check that the arguments for `bind`, `call`, and `apply` methods match the original function. */
|
||||
// "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
|
||||
// "strictOptionalProperties": true, /* Enable strict checking of optional properties. */
|
||||
// "noImplicitThis": true, /* Enable error reporting when `this` is given the type `any`. */
|
||||
// "useUnknownInCatchVariables": true, /* Type catch clause variables as 'unknown' instead of 'any'. */
|
||||
// "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
|
||||
// "noUnusedLocals": true, /* Enable error reporting when a local variables aren't read. */
|
||||
// "noUnusedParameters": true, /* Raise an error when a function parameter isn't read */
|
||||
// "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
|
||||
// "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
|
||||
// "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
|
||||
// "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */
|
||||
|
||||
+1
-1
@@ -79,12 +79,12 @@
|
||||
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
|
||||
// "strictBindCallApply": true, /* Check that the arguments for `bind`, `call`, and `apply` methods match the original function. */
|
||||
// "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
|
||||
// "strictOptionalProperties": true, /* Enable strict checking of optional properties. */
|
||||
// "noImplicitThis": true, /* Enable error reporting when `this` is given the type `any`. */
|
||||
// "useUnknownInCatchVariables": true, /* Type catch clause variables as 'unknown' instead of 'any'. */
|
||||
// "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
|
||||
// "noUnusedLocals": true, /* Enable error reporting when a local variables aren't read. */
|
||||
// "noUnusedParameters": true, /* Raise an error when a function parameter isn't read */
|
||||
// "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
|
||||
// "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
|
||||
// "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
|
||||
// "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */
|
||||
|
||||
+1
-1
@@ -79,12 +79,12 @@
|
||||
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
|
||||
// "strictBindCallApply": true, /* Check that the arguments for `bind`, `call`, and `apply` methods match the original function. */
|
||||
// "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
|
||||
// "strictOptionalProperties": true, /* Enable strict checking of optional properties. */
|
||||
// "noImplicitThis": true, /* Enable error reporting when `this` is given the type `any`. */
|
||||
// "useUnknownInCatchVariables": true, /* Type catch clause variables as 'unknown' instead of 'any'. */
|
||||
// "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
|
||||
// "noUnusedLocals": true, /* Enable error reporting when a local variables aren't read. */
|
||||
// "noUnusedParameters": true, /* Raise an error when a function parameter isn't read */
|
||||
// "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
|
||||
// "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
|
||||
// "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
|
||||
// "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */
|
||||
|
||||
+1
-1
@@ -79,12 +79,12 @@
|
||||
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
|
||||
// "strictBindCallApply": true, /* Check that the arguments for `bind`, `call`, and `apply` methods match the original function. */
|
||||
// "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
|
||||
// "strictOptionalProperties": true, /* Enable strict checking of optional properties. */
|
||||
// "noImplicitThis": true, /* Enable error reporting when `this` is given the type `any`. */
|
||||
// "useUnknownInCatchVariables": true, /* Type catch clause variables as 'unknown' instead of 'any'. */
|
||||
// "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
|
||||
// "noUnusedLocals": true, /* Enable error reporting when a local variables aren't read. */
|
||||
// "noUnusedParameters": true, /* Raise an error when a function parameter isn't read */
|
||||
// "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
|
||||
// "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
|
||||
// "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
|
||||
// "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */
|
||||
|
||||
+1
-1
@@ -100,12 +100,12 @@ interface Array<T> { length: number; [n: number]: T; }
|
||||
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
|
||||
// "strictBindCallApply": true, /* Check that the arguments for `bind`, `call`, and `apply` methods match the original function. */
|
||||
// "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
|
||||
// "strictOptionalProperties": true, /* Enable strict checking of optional properties. */
|
||||
// "noImplicitThis": true, /* Enable error reporting when `this` is given the type `any`. */
|
||||
// "useUnknownInCatchVariables": true, /* Type catch clause variables as 'unknown' instead of 'any'. */
|
||||
// "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
|
||||
// "noUnusedLocals": true, /* Enable error reporting when a local variables aren't read. */
|
||||
// "noUnusedParameters": true, /* Raise an error when a function parameter isn't read */
|
||||
// "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
|
||||
// "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
|
||||
// "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
|
||||
// "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */
|
||||
|
||||
+1
-1
@@ -100,12 +100,12 @@ interface Array<T> { length: number; [n: number]: T; }
|
||||
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
|
||||
// "strictBindCallApply": true, /* Check that the arguments for `bind`, `call`, and `apply` methods match the original function. */
|
||||
// "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
|
||||
// "strictOptionalProperties": true, /* Enable strict checking of optional properties. */
|
||||
// "noImplicitThis": true, /* Enable error reporting when `this` is given the type `any`. */
|
||||
// "useUnknownInCatchVariables": true, /* Type catch clause variables as 'unknown' instead of 'any'. */
|
||||
// "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
|
||||
// "noUnusedLocals": true, /* Enable error reporting when a local variables aren't read. */
|
||||
// "noUnusedParameters": true, /* Raise an error when a function parameter isn't read */
|
||||
// "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
|
||||
// "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
|
||||
// "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
|
||||
// "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */
|
||||
|
||||
+1
-1
@@ -100,12 +100,12 @@ interface Array<T> { length: number; [n: number]: T; }
|
||||
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
|
||||
// "strictBindCallApply": true, /* Check that the arguments for `bind`, `call`, and `apply` methods match the original function. */
|
||||
// "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
|
||||
// "strictOptionalProperties": true, /* Enable strict checking of optional properties. */
|
||||
// "noImplicitThis": true, /* Enable error reporting when `this` is given the type `any`. */
|
||||
// "useUnknownInCatchVariables": true, /* Type catch clause variables as 'unknown' instead of 'any'. */
|
||||
// "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
|
||||
// "noUnusedLocals": true, /* Enable error reporting when a local variables aren't read. */
|
||||
// "noUnusedParameters": true, /* Raise an error when a function parameter isn't read */
|
||||
// "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
|
||||
// "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
|
||||
// "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
|
||||
// "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */
|
||||
|
||||
+1
-1
@@ -100,12 +100,12 @@ interface Array<T> { length: number; [n: number]: T; }
|
||||
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
|
||||
// "strictBindCallApply": true, /* Check that the arguments for `bind`, `call`, and `apply` methods match the original function. */
|
||||
// "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
|
||||
// "strictOptionalProperties": true, /* Enable strict checking of optional properties. */
|
||||
// "noImplicitThis": true, /* Enable error reporting when `this` is given the type `any`. */
|
||||
// "useUnknownInCatchVariables": true, /* Type catch clause variables as 'unknown' instead of 'any'. */
|
||||
// "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
|
||||
// "noUnusedLocals": true, /* Enable error reporting when a local variables aren't read. */
|
||||
// "noUnusedParameters": true, /* Raise an error when a function parameter isn't read */
|
||||
// "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
|
||||
// "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
|
||||
// "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
|
||||
// "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */
|
||||
|
||||
+1
-1
@@ -100,12 +100,12 @@ interface Array<T> { length: number; [n: number]: T; }
|
||||
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
|
||||
// "strictBindCallApply": true, /* Check that the arguments for `bind`, `call`, and `apply` methods match the original function. */
|
||||
// "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
|
||||
// "strictOptionalProperties": true, /* Enable strict checking of optional properties. */
|
||||
// "noImplicitThis": true, /* Enable error reporting when `this` is given the type `any`. */
|
||||
// "useUnknownInCatchVariables": true, /* Type catch clause variables as 'unknown' instead of 'any'. */
|
||||
// "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
|
||||
// "noUnusedLocals": true, /* Enable error reporting when a local variables aren't read. */
|
||||
// "noUnusedParameters": true, /* Raise an error when a function parameter isn't read */
|
||||
// "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
|
||||
// "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
|
||||
// "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
|
||||
// "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */
|
||||
|
||||
+1
-1
@@ -100,12 +100,12 @@ interface Array<T> { length: number; [n: number]: T; }
|
||||
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
|
||||
// "strictBindCallApply": true, /* Check that the arguments for `bind`, `call`, and `apply` methods match the original function. */
|
||||
// "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
|
||||
// "strictOptionalProperties": true, /* Enable strict checking of optional properties. */
|
||||
// "noImplicitThis": true, /* Enable error reporting when `this` is given the type `any`. */
|
||||
// "useUnknownInCatchVariables": true, /* Type catch clause variables as 'unknown' instead of 'any'. */
|
||||
// "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
|
||||
// "noUnusedLocals": true, /* Enable error reporting when a local variables aren't read. */
|
||||
// "noUnusedParameters": true, /* Raise an error when a function parameter isn't read */
|
||||
// "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
|
||||
// "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
|
||||
// "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
|
||||
// "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */
|
||||
|
||||
@@ -20,12 +20,12 @@ const good = <Elem someKey="ok" />;
|
||||
>someKey : string
|
||||
|
||||
declare const Elem2: ComponentType<{ opt?: number }>;
|
||||
>Elem2 : React.ComponentType<{ opt?: number; }>
|
||||
>Elem2 : React.ComponentType<{ opt?: number | undefined; }>
|
||||
>opt : number | undefined
|
||||
|
||||
const alsoOk = <Elem2>text</Elem2>;
|
||||
>alsoOk : JSX.Element
|
||||
><Elem2>text</Elem2> : JSX.Element
|
||||
>Elem2 : React.ComponentType<{ opt?: number; }>
|
||||
>Elem2 : React.ComponentType<{ opt?: number; }>
|
||||
>Elem2 : React.ComponentType<{ opt?: number | undefined; }>
|
||||
>Elem2 : React.ComponentType<{ opt?: number | undefined; }>
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(69,26): error TS2322
|
||||
tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(71,35): error TS2322: Type 'null' is not assignable to type 'ReactNode'.
|
||||
tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(80,38): error TS2322: Type '{ foo: number; bar: string; }' is not assignable to type 'Defaultize<{}, { foo: number; }>'.
|
||||
Property 'bar' does not exist on type 'Defaultize<{}, { foo: number; }>'.
|
||||
tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(81,29): error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(81,29): error TS2322: Type 'string' is not assignable to type 'number | undefined'.
|
||||
tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(98,12): error TS2322: Type '{ foo: string; }' is not assignable to type 'Defaultize<FooProps & InferredPropTypes<{ foo: PropTypeChecker<string, false>; bar: PropTypeChecker<ReactNode, false>; baz: PropTypeChecker<number, true>; }>, { foo: string; }>'.
|
||||
Type '{ foo: string; }' is missing the following properties from type '{ bar: ReactNode | null | undefined; baz: number; }': bar, baz
|
||||
tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(100,56): error TS2322: Type '{ bar: string; baz: number; bat: string; }' is not assignable to type 'Defaultize<FooProps & InferredPropTypes<{ foo: PropTypeChecker<string, false>; bar: PropTypeChecker<ReactNode, false>; baz: PropTypeChecker<number, true>; }>, { foo: string; }>'.
|
||||
@@ -18,7 +18,7 @@ tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(112,46): error TS232
|
||||
tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(113,57): error TS2322: Type 'null' is not assignable to type 'ReactNode'.
|
||||
tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(122,58): error TS2322: Type '{ foo: string; bar: string; }' is not assignable to type 'Defaultize<FooProps, { foo: string; }>'.
|
||||
Property 'bar' does not exist on type 'Defaultize<FooProps, { foo: string; }>'.
|
||||
tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(123,49): error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(123,49): error TS2322: Type 'number' is not assignable to type 'string | undefined'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx (15 errors) ====
|
||||
@@ -121,7 +121,7 @@ tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(123,49): error TS232
|
||||
!!! error TS2322: Property 'bar' does not exist on type 'Defaultize<{}, { foo: number; }>'.
|
||||
const m = <JustDefaultProps foo="no" />; // error, wrong type
|
||||
~~~
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number | undefined'.
|
||||
!!! related TS6500 tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx:75:9: The expected type comes from property 'foo' which is declared here on type 'Defaultize<{}, { foo: number; }>'
|
||||
|
||||
interface FooProps {
|
||||
@@ -186,7 +186,7 @@ tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(123,49): error TS232
|
||||
!!! error TS2322: Property 'bar' does not exist on type 'Defaultize<FooProps, { foo: string; }>'.
|
||||
const z = <JustDefaultPropsWithSpecifiedGeneric foo={12} />; // error, wrong type
|
||||
~~~
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string | undefined'.
|
||||
!!! related TS6500 tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx:117:9: The expected type comes from property 'foo' which is declared here on type 'Defaultize<FooProps, { foo: string; }>'
|
||||
const aa = <JustDefaultPropsWithSpecifiedGeneric />;
|
||||
|
||||
@@ -20,7 +20,7 @@ const o1 = {
|
||||
|
||||
/** @type {{ d(): void; e?(n: number): number; f?(n: number): number; g?: number }} */
|
||||
const o2 = {
|
||||
>o2 : { d(): void; e?(n: number): number; f?(n: number): number; g?: number; }
|
||||
>o2 : { d(): void; e?(n: number): number; f?(n: number): number; g?: number | undefined; }
|
||||
>{ d() { this.e = this.f = m => this.g || m; }} : { d(): void; }
|
||||
|
||||
d() {
|
||||
@@ -29,17 +29,17 @@ const o2 = {
|
||||
this.e = this.f = m => this.g || m;
|
||||
>this.e = this.f = m => this.g || m : (m: number) => number
|
||||
>this.e : ((n: number) => number) | undefined
|
||||
>this : { d(): void; e?(n: number): number; f?(n: number): number; g?: number; }
|
||||
>this : { d(): void; e?(n: number): number; f?(n: number): number; g?: number | undefined; }
|
||||
>e : ((n: number) => number) | undefined
|
||||
>this.f = m => this.g || m : (m: number) => number
|
||||
>this.f : ((n: number) => number) | undefined
|
||||
>this : { d(): void; e?(n: number): number; f?(n: number): number; g?: number; }
|
||||
>this : { d(): void; e?(n: number): number; f?(n: number): number; g?: number | undefined; }
|
||||
>f : ((n: number) => number) | undefined
|
||||
>m => this.g || m : (m: number) => number
|
||||
>m : number
|
||||
>this.g || m : number
|
||||
>this.g : number | undefined
|
||||
>this : { d(): void; e?(n: number): number; f?(n: number): number; g?: number; }
|
||||
>this : { d(): void; e?(n: number): number; f?(n: number): number; g?: number | undefined; }
|
||||
>g : number | undefined
|
||||
>m : number
|
||||
}
|
||||
|
||||
@@ -290,15 +290,15 @@ function check(z: Z, c: C) {
|
||||
|
||||
export function g(pair: [number, string?]): string {
|
||||
>g : (pair: [number, string?]) => string
|
||||
>pair : [number, string?]
|
||||
>pair : [number, (string | undefined)?]
|
||||
|
||||
return pair[1] ? pair[1] : 'nope';
|
||||
>pair[1] ? pair[1] : 'nope' : string
|
||||
>pair[1] : string | undefined
|
||||
>pair : [number, string?]
|
||||
>pair : [number, (string | undefined)?]
|
||||
>1 : 1
|
||||
>pair[1] : string
|
||||
>pair : [number, string?]
|
||||
>pair : [number, (string | undefined)?]
|
||||
>1 : 1
|
||||
>'nope' : "nope"
|
||||
}
|
||||
|
||||
@@ -22,9 +22,9 @@ declare var a: A;
|
||||
>a : A
|
||||
|
||||
ab = {...a, y: (null as any as string | undefined)}; // Should be allowed, since `y` is missing on `A`
|
||||
>ab = {...a, y: (null as any as string | undefined)} : { y: string | undefined; unused?: string; x: string; }
|
||||
>ab = {...a, y: (null as any as string | undefined)} : { y: string | undefined; unused?: string | undefined; x: string; }
|
||||
>ab : A | B
|
||||
>{...a, y: (null as any as string | undefined)} : { y: string | undefined; unused?: string; x: string; }
|
||||
>{...a, y: (null as any as string | undefined)} : { y: string | undefined; unused?: string | undefined; x: string; }
|
||||
>a : A
|
||||
>y : string | undefined
|
||||
>(null as any as string | undefined) : string | undefined
|
||||
|
||||
@@ -213,26 +213,26 @@ async function fun<T>(deepPromised: DeepPromised<T>) {
|
||||
>deepPromised : DeepPromised<T>
|
||||
|
||||
for (const value of Object.values(deepPromisedWithIndexer)) {
|
||||
>value : {} | ({ [containsPromises]?: true; } & {}) | Promise<{ [containsPromises]?: true; } & {}> | null | undefined
|
||||
>Object.values(deepPromisedWithIndexer) : ({} | ({ [containsPromises]?: true; } & {}) | Promise<{ [containsPromises]?: true; } & {}> | null | undefined)[]
|
||||
>value : {} | ({ [containsPromises]?: true | undefined; } & {}) | Promise<{ [containsPromises]?: true | undefined; } & {}> | null | undefined
|
||||
>Object.values(deepPromisedWithIndexer) : ({} | ({ [containsPromises]?: true | undefined; } & {}) | Promise<{ [containsPromises]?: true | undefined; } & {}> | null | undefined)[]
|
||||
>Object.values : { <T>(o: { [s: string]: T; } | ArrayLike<T>): T[]; (o: {}): any[]; }
|
||||
>Object : ObjectConstructor
|
||||
>values : { <T>(o: { [s: string]: T; } | ArrayLike<T>): T[]; (o: {}): any[]; }
|
||||
>deepPromisedWithIndexer : DeepPromised<{ [name: string]: {} | null | undefined; }>
|
||||
|
||||
const awaitedValue = await value;
|
||||
>awaitedValue : {} | ({ [containsPromises]?: true; } & {}) | null | undefined
|
||||
>await value : {} | ({ [containsPromises]?: true; } & {}) | null | undefined
|
||||
>value : {} | ({ [containsPromises]?: true; } & {}) | Promise<{ [containsPromises]?: true; } & {}> | null | undefined
|
||||
>awaitedValue : {} | ({ [containsPromises]?: true | undefined; } & {}) | null | undefined
|
||||
>await value : {} | ({ [containsPromises]?: true | undefined; } & {}) | null | undefined
|
||||
>value : {} | ({ [containsPromises]?: true | undefined; } & {}) | Promise<{ [containsPromises]?: true | undefined; } & {}> | null | undefined
|
||||
|
||||
if (awaitedValue)
|
||||
>awaitedValue : {} | ({ [containsPromises]?: true; } & {}) | null | undefined
|
||||
>awaitedValue : {} | ({ [containsPromises]?: true | undefined; } & {}) | null | undefined
|
||||
|
||||
await fun(awaitedValue);
|
||||
>await fun(awaitedValue) : void
|
||||
>fun(awaitedValue) : Promise<void>
|
||||
>fun : <T>(deepPromised: DeepPromised<T>) => Promise<void>
|
||||
>awaitedValue : {} | ({ [containsPromises]?: true; } & {})
|
||||
>awaitedValue : {} | ({ [containsPromises]?: true | undefined; } & {})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ export function foo<T>(p: Promise<T>) {
|
||||
|
||||
p[FOO_SYMBOL] = 3;
|
||||
>p[FOO_SYMBOL] = 3 : 3
|
||||
>p[FOO_SYMBOL] : number
|
||||
>p[FOO_SYMBOL] : number | undefined
|
||||
>p : Promise<T>
|
||||
>FOO_SYMBOL : unique symbol
|
||||
>3 : 3
|
||||
|
||||
@@ -35,7 +35,7 @@ tests/cases/conformance/types/tuple/variadicTuples1.ts(191,5): error TS2322: Typ
|
||||
'T' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint 'readonly string[]'.
|
||||
tests/cases/conformance/types/tuple/variadicTuples1.ts(203,5): error TS2322: Type 'string' is not assignable to type 'keyof [1, 2, ...T]'.
|
||||
Type '"2"' is not assignable to type 'number | "0" | keyof T[] | "1"'.
|
||||
tests/cases/conformance/types/tuple/variadicTuples1.ts(357,26): error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/types/tuple/variadicTuples1.ts(357,26): error TS2322: Type 'string' is not assignable to type 'number | undefined'.
|
||||
tests/cases/conformance/types/tuple/variadicTuples1.ts(397,7): error TS2322: Type '[false, false]' is not assignable to type '[...number[], boolean]'.
|
||||
Type at position 0 in source is not compatible with type at position 0 in target.
|
||||
Type 'boolean' is not assignable to type 'number'.
|
||||
@@ -456,7 +456,7 @@ tests/cases/conformance/types/tuple/variadicTuples1.ts(397,7): error TS2322: Typ
|
||||
let v1 = f20(args); // U
|
||||
let v2 = f20(["foo", "bar"]); // [string]
|
||||
~~~~~
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number | undefined'.
|
||||
let v3 = f20(["foo", 42]); // [string]
|
||||
}
|
||||
|
||||
|
||||
@@ -412,10 +412,10 @@ type TM1<U extends unknown[]> = Arrayify<readonly [string, number?, ...U, ...boo
|
||||
>TM1 : readonly [string[], (number | undefined)[]?, ...Arrayify<U>, ...boolean[][]]
|
||||
|
||||
type TP1<T extends unknown[]> = Partial<[string, ...T, number]>; // [string?, Partial<T>, number?]
|
||||
>TP1 : [string?, ...Partial<T>, number?]
|
||||
>TP1 : [(string | undefined)?, ...Partial<T>, (number | undefined)?]
|
||||
|
||||
type TP2<T extends unknown[]> = Partial<[string, ...T, ...number[]]>; // [string?, Partial<T>, ...(number | undefined)[]]
|
||||
>TP2 : [string?, ...Partial<T>, ...(number | undefined)[]]
|
||||
>TP2 : [(string | undefined)?, ...Partial<T>, ...(number | undefined)[]]
|
||||
|
||||
// Reverse mapping through mapped type applied to variadic tuple type
|
||||
|
||||
@@ -897,7 +897,7 @@ type T34 = DropLast<[symbol, ...string[]]>;
|
||||
>T34 : [symbol, ...string[]]
|
||||
|
||||
type T35 = DropLast<[string?]>;
|
||||
>T35 : [string?]
|
||||
>T35 : [(string | undefined)?]
|
||||
|
||||
type T36 = DropLast<string[]>;
|
||||
>T36 : string[]
|
||||
@@ -1181,11 +1181,11 @@ curry2(fn10, ['hello'], [42, true]);
|
||||
declare function ft<T extends unknown[]>(t1: [...T], t2: [...T, number?]): T;
|
||||
>ft : <T extends unknown[]>(t1: [...T], t2: [...T, number?]) => T
|
||||
>t1 : [...T]
|
||||
>t2 : [...T, number?]
|
||||
>t2 : [...T, (number | undefined)?]
|
||||
|
||||
ft([1, 2, 3], [1, 2, 3]);
|
||||
>ft([1, 2, 3], [1, 2, 3]) : [number, number, number]
|
||||
>ft : <T extends unknown[]>(t1: [...T], t2: [...T, number?]) => T
|
||||
>ft : <T extends unknown[]>(t1: [...T], t2: [...T, (number | undefined)?]) => T
|
||||
>[1, 2, 3] : [number, number, number]
|
||||
>1 : 1
|
||||
>2 : 2
|
||||
@@ -1197,7 +1197,7 @@ ft([1, 2, 3], [1, 2, 3]);
|
||||
|
||||
ft([1, 2], [1, 2, 3]);
|
||||
>ft([1, 2], [1, 2, 3]) : [number, number]
|
||||
>ft : <T extends unknown[]>(t1: [...T], t2: [...T, number?]) => T
|
||||
>ft : <T extends unknown[]>(t1: [...T], t2: [...T, (number | undefined)?]) => T
|
||||
>[1, 2] : [number, number]
|
||||
>1 : 1
|
||||
>2 : 2
|
||||
@@ -1208,7 +1208,7 @@ ft([1, 2], [1, 2, 3]);
|
||||
|
||||
ft(['a', 'b'], ['c', 'd'])
|
||||
>ft(['a', 'b'], ['c', 'd']) : [string, string]
|
||||
>ft : <T extends unknown[]>(t1: [...T], t2: [...T, number?]) => T
|
||||
>ft : <T extends unknown[]>(t1: [...T], t2: [...T, (number | undefined)?]) => T
|
||||
>['a', 'b'] : [string, string]
|
||||
>'a' : "a"
|
||||
>'b' : "b"
|
||||
@@ -1218,7 +1218,7 @@ ft(['a', 'b'], ['c', 'd'])
|
||||
|
||||
ft(['a', 'b'], ['c', 'd', 42])
|
||||
>ft(['a', 'b'], ['c', 'd', 42]) : [string, string]
|
||||
>ft : <T extends unknown[]>(t1: [...T], t2: [...T, number?]) => T
|
||||
>ft : <T extends unknown[]>(t1: [...T], t2: [...T, (number | undefined)?]) => T
|
||||
>['a', 'b'] : [string, string]
|
||||
>'a' : "a"
|
||||
>'b' : "b"
|
||||
@@ -1257,22 +1257,22 @@ call(...sa, (...x) => 42);
|
||||
|
||||
declare function f20<T extends unknown[] = []>(args: [...T, number?]): T;
|
||||
>f20 : <T extends unknown[] = []>(args: [...T, number?]) => T
|
||||
>args : [...T, number?]
|
||||
>args : [...T, (number | undefined)?]
|
||||
|
||||
function f21<U extends string[]>(args: [...U, number?]) {
|
||||
>f21 : <U extends string[]>(args: [...U, number?]) => void
|
||||
>args : [...U, number?]
|
||||
>args : [...U, (number | undefined)?]
|
||||
|
||||
let v1 = f20(args); // U
|
||||
>v1 : U
|
||||
>f20(args) : U
|
||||
>f20 : <T extends unknown[] = []>(args: [...T, number?]) => T
|
||||
>args : [...U, number?]
|
||||
>f20 : <T extends unknown[] = []>(args: [...T, (number | undefined)?]) => T
|
||||
>args : [...U, (number | undefined)?]
|
||||
|
||||
let v2 = f20(["foo", "bar"]); // [string]
|
||||
>v2 : [string]
|
||||
>f20(["foo", "bar"]) : [string]
|
||||
>f20 : <T extends unknown[] = []>(args: [...T, number?]) => T
|
||||
>f20 : <T extends unknown[] = []>(args: [...T, (number | undefined)?]) => T
|
||||
>["foo", "bar"] : [string, string]
|
||||
>"foo" : "foo"
|
||||
>"bar" : "bar"
|
||||
@@ -1280,7 +1280,7 @@ function f21<U extends string[]>(args: [...U, number?]) {
|
||||
let v3 = f20(["foo", 42]); // [string]
|
||||
>v3 : [string]
|
||||
>f20(["foo", 42]) : [string]
|
||||
>f20 : <T extends unknown[] = []>(args: [...T, number?]) => T
|
||||
>f20 : <T extends unknown[] = []>(args: [...T, (number | undefined)?]) => T
|
||||
>["foo", 42] : [string, number]
|
||||
>"foo" : "foo"
|
||||
>42 : 42
|
||||
@@ -1349,16 +1349,16 @@ const b = a.bind("", 1); // Desc<[boolean], object>
|
||||
// Repro from #39607
|
||||
|
||||
declare function getUser(id: string, options?: { x?: string }): string;
|
||||
>getUser : (id: string, options?: { x?: string; } | undefined) => string
|
||||
>getUser : (id: string, options?: { x?: string | undefined; } | undefined) => string
|
||||
>id : string
|
||||
>options : { x?: string; } | undefined
|
||||
>options : { x?: string | undefined; } | undefined
|
||||
>x : string | undefined
|
||||
|
||||
declare function getOrgUser(id: string, orgId: number, options?: { y?: number, z?: boolean }): void;
|
||||
>getOrgUser : (id: string, orgId: number, options?: { y?: number; z?: boolean; } | undefined) => void
|
||||
>getOrgUser : (id: string, orgId: number, options?: { y?: number | undefined; z?: boolean | undefined; } | undefined) => void
|
||||
>id : string
|
||||
>orgId : number
|
||||
>options : { y?: number; z?: boolean; } | undefined
|
||||
>options : { y?: number | undefined; z?: boolean | undefined; } | undefined
|
||||
>y : number | undefined
|
||||
>z : boolean | undefined
|
||||
|
||||
@@ -1380,12 +1380,12 @@ function callApi<T extends unknown[] = [], U = void>(method: (...args: [...T, ob
|
||||
callApi(getUser);
|
||||
>callApi(getUser) : (id: string) => string
|
||||
>callApi : <T extends unknown[] = [], U = void>(method: (...args: [...T, object]) => U) => (...args_0: T) => U
|
||||
>getUser : (id: string, options?: { x?: string; } | undefined) => string
|
||||
>getUser : (id: string, options?: { x?: string | undefined; } | undefined) => string
|
||||
|
||||
callApi(getOrgUser);
|
||||
>callApi(getOrgUser) : (id: string, orgId: number) => void
|
||||
>callApi : <T extends unknown[] = [], U = void>(method: (...args: [...T, object]) => U) => (...args_0: T) => U
|
||||
>getOrgUser : (id: string, orgId: number, options?: { y?: number; z?: boolean; } | undefined) => void
|
||||
>getOrgUser : (id: string, orgId: number, options?: { y?: number | undefined; z?: boolean | undefined; } | undefined) => void
|
||||
|
||||
// Repro from #40235
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ type V23 = Tup3<[number], string[], [boolean?]>; // [number, (string | boolean
|
||||
>V23 : [number, ...(string | boolean | undefined)[]]
|
||||
|
||||
type V24 = Tup3<[number], [boolean?], string[]>; // [number, boolean?, ...string[]]
|
||||
>V24 : [number, boolean?, ...string[]]
|
||||
>V24 : [number, (boolean | undefined)?, ...string[]]
|
||||
|
||||
type V25 = Tup3<string[], number[], boolean[]>; // (string | number | boolean)[]
|
||||
>V25 : (string | number | boolean)[]
|
||||
@@ -46,7 +46,7 @@ type V26 = Tup3<string[], number[], [boolean]>; // [...(string | number)[], boo
|
||||
>V26 : [...(string | number)[], boolean]
|
||||
|
||||
type V27 = Tup3<[number?], [string], [boolean?]>; // [number | undefined, string, boolean?]
|
||||
>V27 : [number | undefined, string, boolean?]
|
||||
>V27 : [number | undefined, string, (boolean | undefined)?]
|
||||
|
||||
type V30<A extends unknown[]> = Tup3<A, string[], number[]>; // [...A, ...(string | number)[]]
|
||||
>V30 : [...A, ...(string | number)[]]
|
||||
@@ -58,13 +58,13 @@ type V32<A extends unknown[]> = Tup3<string[], number[], A>; // [...(string | n
|
||||
>V32 : [...(string | number)[], ...A]
|
||||
|
||||
type V40<A extends unknown[]> = Tup3<A, [string?], number[]>; // [...A, string?, ...number[]]
|
||||
>V40 : [...A, string?, ...number[]]
|
||||
>V40 : [...A, (string | undefined)?, ...number[]]
|
||||
|
||||
type V41<A extends unknown[]> = Tup3<[string?], A, number[]>; // [string?, ...A, ...number[]]
|
||||
>V41 : [string?, ...A, ...number[]]
|
||||
>V41 : [(string | undefined)?, ...A, ...number[]]
|
||||
|
||||
type V42<A extends unknown[]> = Tup3<[string?], number[], A>; // [string?, ...number[], ...A]
|
||||
>V42 : [string?, ...number[], ...A]
|
||||
>V42 : [(string | undefined)?, ...number[], ...A]
|
||||
|
||||
type V50<A extends unknown[]> = Tup3<A, string[], [number?]>; // [...A, ...(string | number | undefined)[]]
|
||||
>V50 : [...A, ...(string | number | undefined)[]]
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// @strict: true
|
||||
// @strictOptionalProperties: true
|
||||
// @exactOptionalPropertyTypes: true
|
||||
// @declaration: true
|
||||
|
||||
declare function test<T>(x: { [key: string]: T }): T;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// @strict: true
|
||||
// @strictOptionalProperties: true
|
||||
// @exactOptionalPropertyTypes: true
|
||||
// @declaration: true
|
||||
|
||||
declare function test<T>(x: { [key: string]: T }): T;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// @strict: true
|
||||
// @exactOptionalPropertyTypes: true
|
||||
// @declaration: true
|
||||
|
||||
function f1(obj: { a?: string, b?: string | undefined }) {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// @strict: true
|
||||
// @exactOptionalPropertyTypes: true
|
||||
// @declaration: true
|
||||
|
||||
// Repro from #44567
|
||||
|
||||
Reference in New Issue
Block a user