From dc415c5c5e81d6578f58cb1847d0c27926e8a005 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Thu, 25 Jul 2019 09:56:36 -0700 Subject: [PATCH 01/15] Infer between closely matching types in unions and intersections --- src/compiler/checker.ts | 116 +++++++++++++++++++--------------------- 1 file changed, 56 insertions(+), 60 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index f56f56223cf..54c8d05e502 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -15497,37 +15497,27 @@ namespace ts { } return; } - // Find each source constituent type that has an identically matching target constituent - // type, and for each such type infer from the type to itself. When inferring from a - // type to itself we effectively find all type parameter occurrences within that type - // and infer themselves as their type arguments. We have special handling for numeric - // and string literals because the number and string types are not represented as unions - // of all their possible values. - let matchingTypes: Type[] | undefined; - for (const t of (source).types) { - const matched = findMatchedType(t, target); - if (matched) { - (matchingTypes || (matchingTypes = [])).push(matched); - inferFromTypes(matched, matched); - } - } - // Next, to improve the quality of inferences, reduce the source and target types by - // removing the identically matched constituents. For example, when inferring from - // 'string | string[]' to 'string | T' we reduce the types to 'string[]' and 'T'. - if (matchingTypes) { - const s = removeTypesFromUnionOrIntersection(source, matchingTypes); - const t = removeTypesFromUnionOrIntersection(target, matchingTypes); - if (!(s && t)) return; - source = s; - target = t; - } - } - else if (target.flags & TypeFlags.Union && !(target.flags & TypeFlags.EnumLiteral) || target.flags & TypeFlags.Intersection) { - const matched = findMatchedType(source, target); - if (matched) { - inferFromTypes(matched, matched); + // First, infer between exactly matching source and target constituents and remove + // the matching types. Types exactly match when they are identical or, in union + // types, when the source is a literal and the target is the corresponding primitive. + const matching = target.flags & TypeFlags.Union ? isTypeOrBaseExactlyMatchedBy : isTypeExactlyMatchedBy; + const [tempSources, tempTargets] = inferFromMatchingTypes((source).types, (target).types, matching); + // Next, infer between closely matching source and target constituents and remove + // the matching types. Types closely match when they are instantiations of the same + // object type or instantiations of the same type alias. + const [sources, targets] = inferFromMatchingTypes(tempSources, tempTargets, isTypeCloselyMatchedBy); + if (sources.length === 0 || targets.length === 0) { return; } + source = source.flags & TypeFlags.Union ? getUnionType(sources) : getIntersectionType(sources); + target = target.flags & TypeFlags.Union ? getUnionType(targets) : getIntersectionType(targets); + } + else if (target.flags & TypeFlags.Union && !(target.flags & TypeFlags.EnumLiteral) || target.flags & TypeFlags.Intersection) { + // This block of code is an optimized version of the block above for the simpler case + // of a singleton source type. + const matching = target.flags & TypeFlags.Union ? isTypeOrBaseExactlyMatchedBy : isTypeExactlyMatchedBy; + if (inferFromMatchingType(source, (target).types, matching)) return; + if (inferFromMatchingType(source, (target).types, isTypeCloselyMatchedBy)) return; } else if (target.flags & (TypeFlags.IndexedAccess | TypeFlags.Substitution)) { target = getActualTypeVariable(target); @@ -15675,6 +15665,35 @@ namespace ts { visited.set(key, inferenceCount - startCount); } + function inferFromMatchingType(source: Type, targets: Type[], matches: (s: Type, t: Type) => boolean) { + let matched = false; + for (const t of targets) { + if (matches(source, t)) { + inferFromTypes(source, t); + matched = true; + } + } + return matched; + } + + function inferFromMatchingTypes(sources: Type[], targets: Type[], matches: (s: Type, t: Type) => boolean): [Type[], Type[]] { + let matchedSources: Type[] | undefined; + let matchedTargets: Type[] | undefined; + for (const t of targets) { + for (const s of sources) { + if (matches(s, t)) { + inferFromTypes(s, t); + matchedSources = appendIfUnique(matchedSources, s); + matchedTargets = appendIfUnique(matchedTargets, t); + } + } + } + return [ + matchedSources ? filter(sources, t => !contains(matchedSources, t)) : sources, + matchedTargets ? filter(targets, t => !contains(matchedTargets, t)) : targets, + ]; + } + function inferFromTypeArguments(sourceTypes: readonly Type[], targetTypes: readonly Type[], variances: readonly VarianceFlags[]) { const count = sourceTypes.length < targetTypes.length ? sourceTypes.length : targetTypes.length; for (let i = 0; i < count; i++) { @@ -15955,47 +15974,24 @@ namespace ts { } } - function isMatchableType(type: Type) { + function isNonObjectOrAnonymousType(type: Type) { // We exclude non-anonymous object types because some frameworks (e.g. Ember) rely on the ability to // infer between types that don't witness their type variables. Such types would otherwise be eliminated // because they appear identical. return !(type.flags & TypeFlags.Object) || !!(getObjectFlags(type) & ObjectFlags.Anonymous); } - function typeMatchedBySomeType(type: Type, types: Type[]): boolean { - for (const t of types) { - if (t === type || isMatchableType(t) && isMatchableType(type) && isTypeIdenticalTo(t, type)) { - return true; - } - } - return false; + function isTypeExactlyMatchedBy(s: Type, t: Type) { + return s === t || isNonObjectOrAnonymousType(s) && isNonObjectOrAnonymousType(t) && isTypeIdenticalTo(s, t); } - function findMatchedType(type: Type, target: UnionOrIntersectionType) { - if (typeMatchedBySomeType(type, target.types)) { - return type; - } - if (type.flags & (TypeFlags.NumberLiteral | TypeFlags.StringLiteral) && target.flags & TypeFlags.Union) { - const base = getBaseTypeOfLiteralType(type); - if (typeMatchedBySomeType(base, target.types)) { - return base; - } - } - return undefined; + function isTypeOrBaseExactlyMatchedBy(s: Type, t: Type) { + return isTypeExactlyMatchedBy(s, t) || !!(s.flags & (TypeFlags.StringLiteral | TypeFlags.NumberLiteral)) && isTypeIdenticalTo(getBaseTypeOfLiteralType(s), t); } - /** - * Return a new union or intersection type computed by removing a given set of types - * from a given union or intersection type. - */ - function removeTypesFromUnionOrIntersection(type: UnionOrIntersectionType, typesToRemove: Type[]) { - const reducedTypes: Type[] = []; - for (const t of type.types) { - if (!typeMatchedBySomeType(t, typesToRemove)) { - reducedTypes.push(t); - } - } - return reducedTypes.length ? type.flags & TypeFlags.Union ? getUnionType(reducedTypes) : getIntersectionType(reducedTypes) : undefined; + function isTypeCloselyMatchedBy(s: Type, t: Type) { + return !!(s.flags & TypeFlags.Object && t.flags & TypeFlags.Object && s.symbol && s.symbol === t.symbol || + s.aliasSymbol && s.aliasTypeArguments && s.aliasSymbol === t.aliasSymbol); } function hasPrimitiveConstraint(type: TypeParameter): boolean { From 35de142943ea867f302fc8318afa9e9f9bb7c0ad Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Thu, 25 Jul 2019 11:50:50 -0700 Subject: [PATCH 02/15] Accept new baselines --- ...nalNoInfiniteInstantiationDepth.errors.txt | 26 +++++++------------ ...ferredInferenceAllowsAssignment.errors.txt | 26 +++++++------------ 2 files changed, 20 insertions(+), 32 deletions(-) diff --git a/tests/baselines/reference/circularlyConstrainedMappedTypeContainingConditionalNoInfiniteInstantiationDepth.errors.txt b/tests/baselines/reference/circularlyConstrainedMappedTypeContainingConditionalNoInfiniteInstantiationDepth.errors.txt index c7a323f1283..4fad6997145 100644 --- a/tests/baselines/reference/circularlyConstrainedMappedTypeContainingConditionalNoInfiniteInstantiationDepth.errors.txt +++ b/tests/baselines/reference/circularlyConstrainedMappedTypeContainingConditionalNoInfiniteInstantiationDepth.errors.txt @@ -45,14 +45,11 @@ tests/cases/compiler/circularlyConstrainedMappedTypeContainingConditionalNoInfin Type 'TInjectedProps[string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. Type 'TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. Type 'string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string] : GetProps[string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. - Type 'GetProps[string] | (TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string])' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. - Type 'GetProps[string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. - Type 'GetProps[string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. - Type 'string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string] : GetProps[string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. - Type 'keyof GetProps & string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string] : GetProps[keyof GetProps & string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. - Type 'Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. - Type 'Extract> extends keyof TInjectedProps ? TInjectedProps[Extract>] extends GetProps[Extract>] ? GetProps[Extract>] : TInjectedProps[Extract>] : GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. - Type 'P extends keyof TInjectedProps ? TInjectedProps[P] extends GetProps[P] ? GetProps[P] : TInjectedProps[P] : GetProps[P]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type 'string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string] : GetProps[string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type 'keyof GetProps & string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string] : GetProps[keyof GetProps & string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type 'Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type 'Extract> extends keyof TInjectedProps ? TInjectedProps[Extract>] extends GetProps[Extract>] ? GetProps[Extract>] : TInjectedProps[Extract>] : GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type 'P extends keyof TInjectedProps ? TInjectedProps[P] extends GetProps[P] ? GetProps[P] : TInjectedProps[P] : GetProps[P]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. ==== tests/cases/compiler/circularlyConstrainedMappedTypeContainingConditionalNoInfiniteInstantiationDepth.ts (1 errors) ==== @@ -167,12 +164,9 @@ tests/cases/compiler/circularlyConstrainedMappedTypeContainingConditionalNoInfin !!! error TS2344: Type 'TInjectedProps[string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. !!! error TS2344: Type 'TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. !!! error TS2344: Type 'string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string] : GetProps[string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. -!!! error TS2344: Type 'GetProps[string] | (TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string])' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. -!!! error TS2344: Type 'GetProps[string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. -!!! error TS2344: Type 'GetProps[string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. -!!! error TS2344: Type 'string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string] : GetProps[string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. -!!! error TS2344: Type 'keyof GetProps & string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string] : GetProps[keyof GetProps & string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. -!!! error TS2344: Type 'Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. -!!! error TS2344: Type 'Extract> extends keyof TInjectedProps ? TInjectedProps[Extract>] extends GetProps[Extract>] ? GetProps[Extract>] : TInjectedProps[Extract>] : GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. -!!! error TS2344: Type 'P extends keyof TInjectedProps ? TInjectedProps[P] extends GetProps[P] ? GetProps[P] : TInjectedProps[P] : GetProps[P]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type 'string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string] : GetProps[string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type 'keyof GetProps & string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string] : GetProps[keyof GetProps & string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type 'Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type 'Extract> extends keyof TInjectedProps ? TInjectedProps[Extract>] extends GetProps[Extract>] ? GetProps[Extract>] : TInjectedProps[Extract>] : GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type 'P extends keyof TInjectedProps ? TInjectedProps[P] extends GetProps[P] ? GetProps[P] : TInjectedProps[P] : GetProps[P]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. \ No newline at end of file diff --git a/tests/baselines/reference/reactReduxLikeDeferredInferenceAllowsAssignment.errors.txt b/tests/baselines/reference/reactReduxLikeDeferredInferenceAllowsAssignment.errors.txt index 0556ae25c91..0acfd4a8365 100644 --- a/tests/baselines/reference/reactReduxLikeDeferredInferenceAllowsAssignment.errors.txt +++ b/tests/baselines/reference/reactReduxLikeDeferredInferenceAllowsAssignment.errors.txt @@ -45,14 +45,11 @@ tests/cases/compiler/reactReduxLikeDeferredInferenceAllowsAssignment.ts(76,50): Type 'TInjectedProps[string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. Type 'TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. Type 'string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string] : GetProps[string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. - Type 'GetProps[string] | (TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string])' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. - Type 'GetProps[string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. - Type 'GetProps[string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. - Type 'string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string] : GetProps[string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. - Type 'keyof GetProps & string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string] : GetProps[keyof GetProps & string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. - Type 'Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. - Type 'Extract> extends keyof TInjectedProps ? TInjectedProps[Extract>] extends GetProps[Extract>] ? GetProps[Extract>] : TInjectedProps[Extract>] : GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. - Type 'P extends keyof TInjectedProps ? TInjectedProps[P] extends GetProps[P] ? GetProps[P] : TInjectedProps[P] : GetProps[P]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type 'string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string] : GetProps[string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type 'keyof GetProps & string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string] : GetProps[keyof GetProps & string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type 'Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type 'Extract> extends keyof TInjectedProps ? TInjectedProps[Extract>] extends GetProps[Extract>] ? GetProps[Extract>] : TInjectedProps[Extract>] : GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type 'P extends keyof TInjectedProps ? TInjectedProps[P] extends GetProps[P] ? GetProps[P] : TInjectedProps[P] : GetProps[P]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. ==== tests/cases/compiler/reactReduxLikeDeferredInferenceAllowsAssignment.ts (1 errors) ==== @@ -180,14 +177,11 @@ tests/cases/compiler/reactReduxLikeDeferredInferenceAllowsAssignment.ts(76,50): !!! error TS2344: Type 'TInjectedProps[string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. !!! error TS2344: Type 'TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. !!! error TS2344: Type 'string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string] : GetProps[string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. -!!! error TS2344: Type 'GetProps[string] | (TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string])' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. -!!! error TS2344: Type 'GetProps[string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. -!!! error TS2344: Type 'GetProps[string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. -!!! error TS2344: Type 'string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string] : GetProps[string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. -!!! error TS2344: Type 'keyof GetProps & string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string] : GetProps[keyof GetProps & string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. -!!! error TS2344: Type 'Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. -!!! error TS2344: Type 'Extract> extends keyof TInjectedProps ? TInjectedProps[Extract>] extends GetProps[Extract>] ? GetProps[Extract>] : TInjectedProps[Extract>] : GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. -!!! error TS2344: Type 'P extends keyof TInjectedProps ? TInjectedProps[P] extends GetProps[P] ? GetProps[P] : TInjectedProps[P] : GetProps[P]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type 'string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string] : GetProps[string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type 'keyof GetProps & string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string] : GetProps[keyof GetProps & string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type 'Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type 'Extract> extends keyof TInjectedProps ? TInjectedProps[Extract>] extends GetProps[Extract>] ? GetProps[Extract>] : TInjectedProps[Extract>] : GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type 'P extends keyof TInjectedProps ? TInjectedProps[P] extends GetProps[P] ? GetProps[P] : TInjectedProps[P] : GetProps[P]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. >; declare const connect: { From b9d27c0f2ce5df82b8899aca94ed752b626978b0 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Thu, 25 Jul 2019 11:52:08 -0700 Subject: [PATCH 03/15] Add regression tests --- .../unionAndIntersectionInference3.ts | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/tests/cases/conformance/types/typeRelationships/typeInference/unionAndIntersectionInference3.ts b/tests/cases/conformance/types/typeRelationships/typeInference/unionAndIntersectionInference3.ts index aad083a626b..17057de2b84 100644 --- a/tests/cases/conformance/types/typeRelationships/typeInference/unionAndIntersectionInference3.ts +++ b/tests/cases/conformance/types/typeRelationships/typeInference/unionAndIntersectionInference3.ts @@ -1,7 +1,42 @@ // @strict: true +// @target: esnext // Repro from #30720 type Maybe = T | undefined; declare function concatMaybe(...args: (Maybe | Maybe[])[]): T[]; concatMaybe([1, 2, 3], 4); + +// Repros from #32247 + +const g: (com: () => Iterator | AsyncIterator) => Promise = async (com: () => Iterator | AsyncIterator): Promise => { + throw com; +}; + +interface Foo1 { + test(value: T): void; +} + +interface Bar1 { + test(value: T | PromiseLike): void; +} + +declare let f1: (x: Foo1 | Bar1) => Promise; +declare let f2: (x: Foo1 | Bar1) => Promise; + +f1 = f2; +f2 = f1; + +type Foo2 = { + test(value: T): void; +} + +type Bar2 = { + test(value: T | PromiseLike): void; +} + +declare let g1: (x: Foo2 | Bar2) => Promise; +declare let g2: (x: Foo2 | Bar2) => Promise; + +g1 = g2; +g2 = g1; From 540134840da0acea39f103b12719392c41b9a67d Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Thu, 25 Jul 2019 11:52:15 -0700 Subject: [PATCH 04/15] Accept new baselines --- .../unionAndIntersectionInference3.js | 42 ++++++ .../unionAndIntersectionInference3.symbols | 142 ++++++++++++++++++ .../unionAndIntersectionInference3.types | 77 ++++++++++ 3 files changed, 261 insertions(+) diff --git a/tests/baselines/reference/unionAndIntersectionInference3.js b/tests/baselines/reference/unionAndIntersectionInference3.js index 4cc0c2f667e..c9f5cffa1f7 100644 --- a/tests/baselines/reference/unionAndIntersectionInference3.js +++ b/tests/baselines/reference/unionAndIntersectionInference3.js @@ -4,9 +4,51 @@ type Maybe = T | undefined; declare function concatMaybe(...args: (Maybe | Maybe[])[]): T[]; concatMaybe([1, 2, 3], 4); + +// Repros from #32247 + +const g: (com: () => Iterator | AsyncIterator) => Promise = async (com: () => Iterator | AsyncIterator): Promise => { + throw com; +}; + +interface Foo1 { + test(value: T): void; +} + +interface Bar1 { + test(value: T | PromiseLike): void; +} + +declare let f1: (x: Foo1 | Bar1) => Promise; +declare let f2: (x: Foo1 | Bar1) => Promise; + +f1 = f2; +f2 = f1; + +type Foo2 = { + test(value: T): void; +} + +type Bar2 = { + test(value: T | PromiseLike): void; +} + +declare let g1: (x: Foo2 | Bar2) => Promise; +declare let g2: (x: Foo2 | Bar2) => Promise; + +g1 = g2; +g2 = g1; //// [unionAndIntersectionInference3.js] "use strict"; // Repro from #30720 concatMaybe([1, 2, 3], 4); +// Repros from #32247 +const g = async (com) => { + throw com; +}; +f1 = f2; +f2 = f1; +g1 = g2; +g2 = g1; diff --git a/tests/baselines/reference/unionAndIntersectionInference3.symbols b/tests/baselines/reference/unionAndIntersectionInference3.symbols index be24bc0cc77..b854ee1ce42 100644 --- a/tests/baselines/reference/unionAndIntersectionInference3.symbols +++ b/tests/baselines/reference/unionAndIntersectionInference3.symbols @@ -19,3 +19,145 @@ declare function concatMaybe(...args: (Maybe | Maybe[])[]): T[]; concatMaybe([1, 2, 3], 4); >concatMaybe : Symbol(concatMaybe, Decl(unionAndIntersectionInference3.ts, 2, 30)) +// Repros from #32247 + +const g: (com: () => Iterator | AsyncIterator) => Promise = async (com: () => Iterator | AsyncIterator): Promise => { +>g : Symbol(g, Decl(unionAndIntersectionInference3.ts, 8, 5)) +>U : Symbol(U, Decl(unionAndIntersectionInference3.ts, 8, 10)) +>R : Symbol(R, Decl(unionAndIntersectionInference3.ts, 8, 12)) +>S : Symbol(S, Decl(unionAndIntersectionInference3.ts, 8, 15)) +>com : Symbol(com, Decl(unionAndIntersectionInference3.ts, 8, 19)) +>Iterator : Symbol(Iterator, Decl(lib.es2015.iterable.d.ts, --, --)) +>S : Symbol(S, Decl(unionAndIntersectionInference3.ts, 8, 15)) +>U : Symbol(U, Decl(unionAndIntersectionInference3.ts, 8, 10)) +>R : Symbol(R, Decl(unionAndIntersectionInference3.ts, 8, 12)) +>AsyncIterator : Symbol(AsyncIterator, Decl(lib.es2018.asynciterable.d.ts, --, --)) +>S : Symbol(S, Decl(unionAndIntersectionInference3.ts, 8, 15)) +>U : Symbol(U, Decl(unionAndIntersectionInference3.ts, 8, 10)) +>R : Symbol(R, Decl(unionAndIntersectionInference3.ts, 8, 12)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2018.promise.d.ts, --, --)) +>U : Symbol(U, Decl(unionAndIntersectionInference3.ts, 8, 10)) +>U : Symbol(U, Decl(unionAndIntersectionInference3.ts, 8, 97)) +>R : Symbol(R, Decl(unionAndIntersectionInference3.ts, 8, 99)) +>S : Symbol(S, Decl(unionAndIntersectionInference3.ts, 8, 102)) +>com : Symbol(com, Decl(unionAndIntersectionInference3.ts, 8, 106)) +>Iterator : Symbol(Iterator, Decl(lib.es2015.iterable.d.ts, --, --)) +>S : Symbol(S, Decl(unionAndIntersectionInference3.ts, 8, 102)) +>U : Symbol(U, Decl(unionAndIntersectionInference3.ts, 8, 97)) +>R : Symbol(R, Decl(unionAndIntersectionInference3.ts, 8, 99)) +>AsyncIterator : Symbol(AsyncIterator, Decl(lib.es2018.asynciterable.d.ts, --, --)) +>S : Symbol(S, Decl(unionAndIntersectionInference3.ts, 8, 102)) +>U : Symbol(U, Decl(unionAndIntersectionInference3.ts, 8, 97)) +>R : Symbol(R, Decl(unionAndIntersectionInference3.ts, 8, 99)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2018.promise.d.ts, --, --)) +>U : Symbol(U, Decl(unionAndIntersectionInference3.ts, 8, 97)) + + throw com; +>com : Symbol(com, Decl(unionAndIntersectionInference3.ts, 8, 106)) + +}; + +interface Foo1 { +>Foo1 : Symbol(Foo1, Decl(unionAndIntersectionInference3.ts, 10, 2)) +>T : Symbol(T, Decl(unionAndIntersectionInference3.ts, 12, 15)) + + test(value: T): void; +>test : Symbol(Foo1.test, Decl(unionAndIntersectionInference3.ts, 12, 19)) +>value : Symbol(value, Decl(unionAndIntersectionInference3.ts, 13, 9)) +>T : Symbol(T, Decl(unionAndIntersectionInference3.ts, 12, 15)) +} + +interface Bar1 { +>Bar1 : Symbol(Bar1, Decl(unionAndIntersectionInference3.ts, 14, 1)) +>T : Symbol(T, Decl(unionAndIntersectionInference3.ts, 16, 15)) + + test(value: T | PromiseLike): void; +>test : Symbol(Bar1.test, Decl(unionAndIntersectionInference3.ts, 16, 19)) +>value : Symbol(value, Decl(unionAndIntersectionInference3.ts, 17, 9)) +>T : Symbol(T, Decl(unionAndIntersectionInference3.ts, 16, 15)) +>PromiseLike : Symbol(PromiseLike, Decl(lib.es5.d.ts, --, --)) +>T : Symbol(T, Decl(unionAndIntersectionInference3.ts, 16, 15)) +} + +declare let f1: (x: Foo1 | Bar1) => Promise; +>f1 : Symbol(f1, Decl(unionAndIntersectionInference3.ts, 20, 11)) +>T : Symbol(T, Decl(unionAndIntersectionInference3.ts, 20, 17)) +>x : Symbol(x, Decl(unionAndIntersectionInference3.ts, 20, 20)) +>Foo1 : Symbol(Foo1, Decl(unionAndIntersectionInference3.ts, 10, 2)) +>T : Symbol(T, Decl(unionAndIntersectionInference3.ts, 20, 17)) +>Bar1 : Symbol(Bar1, Decl(unionAndIntersectionInference3.ts, 14, 1)) +>T : Symbol(T, Decl(unionAndIntersectionInference3.ts, 20, 17)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2018.promise.d.ts, --, --)) +>T : Symbol(T, Decl(unionAndIntersectionInference3.ts, 20, 17)) + +declare let f2: (x: Foo1 | Bar1) => Promise; +>f2 : Symbol(f2, Decl(unionAndIntersectionInference3.ts, 21, 11)) +>U : Symbol(U, Decl(unionAndIntersectionInference3.ts, 21, 17)) +>x : Symbol(x, Decl(unionAndIntersectionInference3.ts, 21, 20)) +>Foo1 : Symbol(Foo1, Decl(unionAndIntersectionInference3.ts, 10, 2)) +>U : Symbol(U, Decl(unionAndIntersectionInference3.ts, 21, 17)) +>Bar1 : Symbol(Bar1, Decl(unionAndIntersectionInference3.ts, 14, 1)) +>U : Symbol(U, Decl(unionAndIntersectionInference3.ts, 21, 17)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2018.promise.d.ts, --, --)) +>U : Symbol(U, Decl(unionAndIntersectionInference3.ts, 21, 17)) + +f1 = f2; +>f1 : Symbol(f1, Decl(unionAndIntersectionInference3.ts, 20, 11)) +>f2 : Symbol(f2, Decl(unionAndIntersectionInference3.ts, 21, 11)) + +f2 = f1; +>f2 : Symbol(f2, Decl(unionAndIntersectionInference3.ts, 21, 11)) +>f1 : Symbol(f1, Decl(unionAndIntersectionInference3.ts, 20, 11)) + +type Foo2 = { +>Foo2 : Symbol(Foo2, Decl(unionAndIntersectionInference3.ts, 24, 8)) +>T : Symbol(T, Decl(unionAndIntersectionInference3.ts, 26, 10)) + + test(value: T): void; +>test : Symbol(test, Decl(unionAndIntersectionInference3.ts, 26, 16)) +>value : Symbol(value, Decl(unionAndIntersectionInference3.ts, 27, 9)) +>T : Symbol(T, Decl(unionAndIntersectionInference3.ts, 26, 10)) +} + +type Bar2 = { +>Bar2 : Symbol(Bar2, Decl(unionAndIntersectionInference3.ts, 28, 1)) +>T : Symbol(T, Decl(unionAndIntersectionInference3.ts, 30, 10)) + + test(value: T | PromiseLike): void; +>test : Symbol(test, Decl(unionAndIntersectionInference3.ts, 30, 16)) +>value : Symbol(value, Decl(unionAndIntersectionInference3.ts, 31, 9)) +>T : Symbol(T, Decl(unionAndIntersectionInference3.ts, 30, 10)) +>PromiseLike : Symbol(PromiseLike, Decl(lib.es5.d.ts, --, --)) +>T : Symbol(T, Decl(unionAndIntersectionInference3.ts, 30, 10)) +} + +declare let g1: (x: Foo2 | Bar2) => Promise; +>g1 : Symbol(g1, Decl(unionAndIntersectionInference3.ts, 34, 11)) +>T : Symbol(T, Decl(unionAndIntersectionInference3.ts, 34, 17)) +>x : Symbol(x, Decl(unionAndIntersectionInference3.ts, 34, 20)) +>Foo2 : Symbol(Foo2, Decl(unionAndIntersectionInference3.ts, 24, 8)) +>T : Symbol(T, Decl(unionAndIntersectionInference3.ts, 34, 17)) +>Bar2 : Symbol(Bar2, Decl(unionAndIntersectionInference3.ts, 28, 1)) +>T : Symbol(T, Decl(unionAndIntersectionInference3.ts, 34, 17)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2018.promise.d.ts, --, --)) +>T : Symbol(T, Decl(unionAndIntersectionInference3.ts, 34, 17)) + +declare let g2: (x: Foo2 | Bar2) => Promise; +>g2 : Symbol(g2, Decl(unionAndIntersectionInference3.ts, 35, 11)) +>U : Symbol(U, Decl(unionAndIntersectionInference3.ts, 35, 17)) +>x : Symbol(x, Decl(unionAndIntersectionInference3.ts, 35, 20)) +>Foo2 : Symbol(Foo2, Decl(unionAndIntersectionInference3.ts, 24, 8)) +>U : Symbol(U, Decl(unionAndIntersectionInference3.ts, 35, 17)) +>Bar2 : Symbol(Bar2, Decl(unionAndIntersectionInference3.ts, 28, 1)) +>U : Symbol(U, Decl(unionAndIntersectionInference3.ts, 35, 17)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2018.promise.d.ts, --, --)) +>U : Symbol(U, Decl(unionAndIntersectionInference3.ts, 35, 17)) + +g1 = g2; +>g1 : Symbol(g1, Decl(unionAndIntersectionInference3.ts, 34, 11)) +>g2 : Symbol(g2, Decl(unionAndIntersectionInference3.ts, 35, 11)) + +g2 = g1; +>g2 : Symbol(g2, Decl(unionAndIntersectionInference3.ts, 35, 11)) +>g1 : Symbol(g1, Decl(unionAndIntersectionInference3.ts, 34, 11)) + diff --git a/tests/baselines/reference/unionAndIntersectionInference3.types b/tests/baselines/reference/unionAndIntersectionInference3.types index 8497cb1e516..acbca0a1eae 100644 --- a/tests/baselines/reference/unionAndIntersectionInference3.types +++ b/tests/baselines/reference/unionAndIntersectionInference3.types @@ -17,3 +17,80 @@ concatMaybe([1, 2, 3], 4); >3 : 3 >4 : 4 +// Repros from #32247 + +const g: (com: () => Iterator | AsyncIterator) => Promise = async (com: () => Iterator | AsyncIterator): Promise => { +>g : (com: () => Iterator | AsyncIterator) => Promise +>com : () => Iterator | AsyncIterator +>async (com: () => Iterator | AsyncIterator): Promise => { throw com;} : (com: () => Iterator | AsyncIterator) => Promise +>com : () => Iterator | AsyncIterator + + throw com; +>com : () => Iterator | AsyncIterator + +}; + +interface Foo1 { + test(value: T): void; +>test : (value: T) => void +>value : T +} + +interface Bar1 { + test(value: T | PromiseLike): void; +>test : (value: T | PromiseLike) => void +>value : T | PromiseLike +} + +declare let f1: (x: Foo1 | Bar1) => Promise; +>f1 : (x: Foo1 | Bar1) => Promise +>x : Foo1 | Bar1 + +declare let f2: (x: Foo1 | Bar1) => Promise; +>f2 : (x: Foo1 | Bar1) => Promise +>x : Foo1 | Bar1 + +f1 = f2; +>f1 = f2 : (x: Foo1 | Bar1) => Promise +>f1 : (x: Foo1 | Bar1) => Promise +>f2 : (x: Foo1 | Bar1) => Promise + +f2 = f1; +>f2 = f1 : (x: Foo1 | Bar1) => Promise +>f2 : (x: Foo1 | Bar1) => Promise +>f1 : (x: Foo1 | Bar1) => Promise + +type Foo2 = { +>Foo2 : Foo2 + + test(value: T): void; +>test : (value: T) => void +>value : T +} + +type Bar2 = { +>Bar2 : Bar2 + + test(value: T | PromiseLike): void; +>test : (value: T | PromiseLike) => void +>value : T | PromiseLike +} + +declare let g1: (x: Foo2 | Bar2) => Promise; +>g1 : (x: Foo2 | Bar2) => Promise +>x : Foo2 | Bar2 + +declare let g2: (x: Foo2 | Bar2) => Promise; +>g2 : (x: Foo2 | Bar2) => Promise +>x : Foo2 | Bar2 + +g1 = g2; +>g1 = g2 : (x: Foo2 | Bar2) => Promise +>g1 : (x: Foo2 | Bar2) => Promise +>g2 : (x: Foo2 | Bar2) => Promise + +g2 = g1; +>g2 = g1 : (x: Foo2 | Bar2) => Promise +>g2 : (x: Foo2 | Bar2) => Promise +>g1 : (x: Foo2 | Bar2) => Promise + From 4c76bae8880d97d01847064cd98befba8f42028a Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Thu, 25 Jul 2019 14:03:17 -0700 Subject: [PATCH 05/15] Don't exclude non-anonymous object types in identity checks --- src/compiler/checker.ts | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 54c8d05e502..0f8326c1fac 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -15500,7 +15500,7 @@ namespace ts { // First, infer between exactly matching source and target constituents and remove // the matching types. Types exactly match when they are identical or, in union // types, when the source is a literal and the target is the corresponding primitive. - const matching = target.flags & TypeFlags.Union ? isTypeOrBaseExactlyMatchedBy : isTypeExactlyMatchedBy; + const matching = target.flags & TypeFlags.Union ? isTypeOrBaseIdenticalTo : isTypeIdenticalTo; const [tempSources, tempTargets] = inferFromMatchingTypes((source).types, (target).types, matching); // Next, infer between closely matching source and target constituents and remove // the matching types. Types closely match when they are instantiations of the same @@ -15515,7 +15515,7 @@ namespace ts { else if (target.flags & TypeFlags.Union && !(target.flags & TypeFlags.EnumLiteral) || target.flags & TypeFlags.Intersection) { // This block of code is an optimized version of the block above for the simpler case // of a singleton source type. - const matching = target.flags & TypeFlags.Union ? isTypeOrBaseExactlyMatchedBy : isTypeExactlyMatchedBy; + const matching = target.flags & TypeFlags.Union ? isTypeOrBaseIdenticalTo : isTypeIdenticalTo; if (inferFromMatchingType(source, (target).types, matching)) return; if (inferFromMatchingType(source, (target).types, isTypeCloselyMatchedBy)) return; } @@ -15974,19 +15974,8 @@ namespace ts { } } - function isNonObjectOrAnonymousType(type: Type) { - // We exclude non-anonymous object types because some frameworks (e.g. Ember) rely on the ability to - // infer between types that don't witness their type variables. Such types would otherwise be eliminated - // because they appear identical. - return !(type.flags & TypeFlags.Object) || !!(getObjectFlags(type) & ObjectFlags.Anonymous); - } - - function isTypeExactlyMatchedBy(s: Type, t: Type) { - return s === t || isNonObjectOrAnonymousType(s) && isNonObjectOrAnonymousType(t) && isTypeIdenticalTo(s, t); - } - - function isTypeOrBaseExactlyMatchedBy(s: Type, t: Type) { - return isTypeExactlyMatchedBy(s, t) || !!(s.flags & (TypeFlags.StringLiteral | TypeFlags.NumberLiteral)) && isTypeIdenticalTo(getBaseTypeOfLiteralType(s), t); + function isTypeOrBaseIdenticalTo(s: Type, t: Type) { + return isTypeIdenticalTo(s, t) || !!(s.flags & (TypeFlags.StringLiteral | TypeFlags.NumberLiteral)) && isTypeIdenticalTo(getBaseTypeOfLiteralType(s), t); } function isTypeCloselyMatchedBy(s: Type, t: Type) { From 9647506d8c6dea0c2531f5f4867971e419799e1f Mon Sep 17 00:00:00 2001 From: Andrew Casey Date: Wed, 24 Jul 2019 15:57:46 -0700 Subject: [PATCH 06/15] Support classification of triple-slash references Note: not restricted to the element and attribute names that actually bind --- src/services/classifier.ts | 83 +++++++++++++++++++ .../syntacticClassificationsTripleSlash1.ts | 15 ++++ .../syntacticClassificationsTripleSlash10.ts | 13 +++ .../syntacticClassificationsTripleSlash11.ts | 15 ++++ .../syntacticClassificationsTripleSlash12.ts | 19 +++++ .../syntacticClassificationsTripleSlash13.ts | 16 ++++ .../syntacticClassificationsTripleSlash14.ts | 7 ++ .../syntacticClassificationsTripleSlash15.ts | 25 ++++++ .../syntacticClassificationsTripleSlash16.ts | 17 ++++ .../syntacticClassificationsTripleSlash2.ts | 16 ++++ .../syntacticClassificationsTripleSlash3.ts | 19 +++++ .../syntacticClassificationsTripleSlash4.ts | 8 ++ .../syntacticClassificationsTripleSlash5.ts | 9 ++ .../syntacticClassificationsTripleSlash6.ts | 10 +++ .../syntacticClassificationsTripleSlash7.ts | 10 +++ .../syntacticClassificationsTripleSlash8.ts | 10 +++ .../syntacticClassificationsTripleSlash9.ts | 10 +++ 17 files changed, 302 insertions(+) create mode 100644 tests/cases/fourslash/syntacticClassificationsTripleSlash1.ts create mode 100644 tests/cases/fourslash/syntacticClassificationsTripleSlash10.ts create mode 100644 tests/cases/fourslash/syntacticClassificationsTripleSlash11.ts create mode 100644 tests/cases/fourslash/syntacticClassificationsTripleSlash12.ts create mode 100644 tests/cases/fourslash/syntacticClassificationsTripleSlash13.ts create mode 100644 tests/cases/fourslash/syntacticClassificationsTripleSlash14.ts create mode 100644 tests/cases/fourslash/syntacticClassificationsTripleSlash15.ts create mode 100644 tests/cases/fourslash/syntacticClassificationsTripleSlash16.ts create mode 100644 tests/cases/fourslash/syntacticClassificationsTripleSlash2.ts create mode 100644 tests/cases/fourslash/syntacticClassificationsTripleSlash3.ts create mode 100644 tests/cases/fourslash/syntacticClassificationsTripleSlash4.ts create mode 100644 tests/cases/fourslash/syntacticClassificationsTripleSlash5.ts create mode 100644 tests/cases/fourslash/syntacticClassificationsTripleSlash6.ts create mode 100644 tests/cases/fourslash/syntacticClassificationsTripleSlash7.ts create mode 100644 tests/cases/fourslash/syntacticClassificationsTripleSlash8.ts create mode 100644 tests/cases/fourslash/syntacticClassificationsTripleSlash9.ts diff --git a/src/services/classifier.ts b/src/services/classifier.ts index f85a69681de..f1db477481f 100644 --- a/src/services/classifier.ts +++ b/src/services/classifier.ts @@ -683,6 +683,11 @@ namespace ts { return; } } + else if (kind === SyntaxKind.SingleLineCommentTrivia) { + if (tryClassifyTripleSlashComment(start, width)) { + return; + } + } // Simple comment. Just add as is. pushCommentRange(start, width); @@ -755,6 +760,84 @@ namespace ts { } } + function tryClassifyTripleSlashComment(start: number, width: number): boolean { + const tripleSlashXMLCommentRegEx = /^(\/\/\/\s*)(<)(?:(\S+)((?:[^/]|\/[^>])*)(\/>)?)?/im; + const attributeRegex = /(\S+)(\s*)(=)(\s*)('[^']+'|"[^"]+")/img; + + const text = sourceFile.text.substr(start, width); + const match = tripleSlashXMLCommentRegEx.exec(text); + if (!match) { + return false; + } + + let pos = start; + + pushCommentRange(pos, match[1].length); // /// + pos += match[1].length; + + pushClassification(pos, match[2].length, ClassificationType.punctuation); // < + pos += match[2].length; + + if (!match[3]) { + return true; + } + + pushClassification(pos, match[3].length, ClassificationType.jsxSelfClosingTagName); // element name + pos += match[3].length; + + const attrText = match[4]; + let attrPos = pos; + while (true) { + const attrMatch = attributeRegex.exec(attrText); + if (!attrMatch) { + break; + } + + const newAttrPos = pos + attrMatch.index; + if (newAttrPos > attrPos) { + pushCommentRange(attrPos, newAttrPos - attrPos); + attrPos = newAttrPos; + } + + pushClassification(attrPos, attrMatch[1].length, ClassificationType.jsxAttribute); // attribute name + attrPos += attrMatch[1].length; + + if (attrMatch[2].length) { + pushCommentRange(attrPos, attrMatch[2].length); // whitespace + attrPos += attrMatch[2].length; + } + + pushClassification(attrPos, attrMatch[3].length, ClassificationType.operator); // = + attrPos += attrMatch[3].length; + + if (attrMatch[4].length) { + pushCommentRange(attrPos, attrMatch[4].length); // whitespace + attrPos += attrMatch[4].length; + } + + pushClassification(attrPos, attrMatch[5].length, ClassificationType.jsxAttributeStringLiteralValue); // attribute value + attrPos += attrMatch[5].length; + } + + pos += match[4].length; + + if (pos > attrPos) { + pushCommentRange(attrPos, pos - attrPos); + } + + if (match[5]) { + pushClassification(pos, match[5].length, ClassificationType.punctuation); // /> + pos += match[5].length; + } + + const end = start + width; + if (pos < end) { + pushCommentRange(pos, end - pos); + } + + return true; + } + function processJSDocTemplateTag(tag: JSDocTemplateTag) { for (const child of tag.getChildren()) { processElement(child); diff --git a/tests/cases/fourslash/syntacticClassificationsTripleSlash1.ts b/tests/cases/fourslash/syntacticClassificationsTripleSlash1.ts new file mode 100644 index 00000000000..13c27669ad5 --- /dev/null +++ b/tests/cases/fourslash/syntacticClassificationsTripleSlash1.ts @@ -0,0 +1,15 @@ +/// + +//// /// + +var c = classification; +verify.syntacticClassificationsAre( + c.comment("/// "), + c.punctuation("<"), + c.jsxSelfClosingTagName("reference"), + c.comment(" "), + c.jsxAttribute("path"), + c.operator("="), + c.jsxAttributeStringLiteralValue("\"./module.ts\""), + c.comment(" "), + c.punctuation("/>")); \ No newline at end of file diff --git a/tests/cases/fourslash/syntacticClassificationsTripleSlash10.ts b/tests/cases/fourslash/syntacticClassificationsTripleSlash10.ts new file mode 100644 index 00000000000..d1bb681b92e --- /dev/null +++ b/tests/cases/fourslash/syntacticClassificationsTripleSlash10.ts @@ -0,0 +1,13 @@ +/// + +//// /// + +//// /// + +//// /// + +var c = classification; +verify.syntacticClassificationsAre( + c.comment("/// "), + c.punctuation("<"), + c.jsxSelfClosingTagName("reference"), + c.comment(" "), + c.jsxAttribute("path"), + c.operator("="), + c.jsxAttributeStringLiteralValue("\"./module.ts\""), + c.comment(" bad "), + c.jsxAttribute("types"), + c.operator("="), + c.jsxAttributeStringLiteralValue("\"node\""), + c.comment(" "), + c.punctuation("/>")); \ No newline at end of file diff --git a/tests/cases/fourslash/syntacticClassificationsTripleSlash13.ts b/tests/cases/fourslash/syntacticClassificationsTripleSlash13.ts new file mode 100644 index 00000000000..182b01f7560 --- /dev/null +++ b/tests/cases/fourslash/syntacticClassificationsTripleSlash13.ts @@ -0,0 +1,16 @@ +/// + +//// /// trailing + +var c = classification; +verify.syntacticClassificationsAre( + c.comment("/// "), + c.punctuation("<"), + c.jsxSelfClosingTagName("reference"), + c.comment(" "), + c.jsxAttribute("path"), + c.operator("="), + c.jsxAttributeStringLiteralValue("\"./module.ts\""), + c.comment(" "), + c.punctuation("/>"), + c.comment(" trailing")); \ No newline at end of file diff --git a/tests/cases/fourslash/syntacticClassificationsTripleSlash14.ts b/tests/cases/fourslash/syntacticClassificationsTripleSlash14.ts new file mode 100644 index 00000000000..a7d16fea02c --- /dev/null +++ b/tests/cases/fourslash/syntacticClassificationsTripleSlash14.ts @@ -0,0 +1,7 @@ +/// + +//// /// nonElement + +var c = classification; +verify.syntacticClassificationsAre( + c.comment("/// nonElement")); \ No newline at end of file diff --git a/tests/cases/fourslash/syntacticClassificationsTripleSlash15.ts b/tests/cases/fourslash/syntacticClassificationsTripleSlash15.ts new file mode 100644 index 00000000000..8ec5ebbea5d --- /dev/null +++ b/tests/cases/fourslash/syntacticClassificationsTripleSlash15.ts @@ -0,0 +1,25 @@ +/// + +//// /// +//// /// + +var c = classification; +verify.syntacticClassificationsAre( + c.comment("/// "), + c.punctuation("<"), + c.jsxSelfClosingTagName("reference"), + c.comment(" "), + c.jsxAttribute("path"), + c.operator("="), + c.jsxAttributeStringLiteralValue("\"./module1.ts\""), + c.comment(" "), + c.punctuation("/>"), + c.comment("/// "), + c.punctuation("<"), + c.jsxSelfClosingTagName("reference"), + c.comment(" "), + c.jsxAttribute("path"), + c.operator("="), + c.jsxAttributeStringLiteralValue("\"./module2.ts\""), + c.comment(" "), + c.punctuation("/>")); \ No newline at end of file diff --git a/tests/cases/fourslash/syntacticClassificationsTripleSlash16.ts b/tests/cases/fourslash/syntacticClassificationsTripleSlash16.ts new file mode 100644 index 00000000000..1dbee22cb59 --- /dev/null +++ b/tests/cases/fourslash/syntacticClassificationsTripleSlash16.ts @@ -0,0 +1,17 @@ +/// + +//// /// +//// 1 + +var c = classification; +verify.syntacticClassificationsAre( + c.comment("/// "), + c.punctuation("<"), + c.jsxSelfClosingTagName("reference"), + c.comment(" "), + c.jsxAttribute("path"), + c.operator("="), + c.jsxAttributeStringLiteralValue("\"./module.ts\""), + c.comment(" "), + c.punctuation("/>"), + c.numericLiteral("1")); \ No newline at end of file diff --git a/tests/cases/fourslash/syntacticClassificationsTripleSlash2.ts b/tests/cases/fourslash/syntacticClassificationsTripleSlash2.ts new file mode 100644 index 00000000000..278d66dcb4a --- /dev/null +++ b/tests/cases/fourslash/syntacticClassificationsTripleSlash2.ts @@ -0,0 +1,16 @@ +/// + +//// /// + +var c = classification; +verify.syntacticClassificationsAre( + c.comment("///"), + c.punctuation("<"), + c.jsxSelfClosingTagName("reference"), + c.comment(" "), + c.jsxAttribute("path"), + c.comment(" "), + c.operator("="), + c.comment(" "), + c.jsxAttributeStringLiteralValue("\"./module.ts\""), + c.punctuation("/>")); \ No newline at end of file diff --git a/tests/cases/fourslash/syntacticClassificationsTripleSlash3.ts b/tests/cases/fourslash/syntacticClassificationsTripleSlash3.ts new file mode 100644 index 00000000000..11d3b2462be --- /dev/null +++ b/tests/cases/fourslash/syntacticClassificationsTripleSlash3.ts @@ -0,0 +1,19 @@ +/// + +//// /// + +var c = classification; +verify.syntacticClassificationsAre( + c.comment("/// "), + c.punctuation("<"), + c.jsxSelfClosingTagName("reference"), + c.comment(" "), + c.jsxAttribute("path"), + c.operator("="), + c.jsxAttributeStringLiteralValue("\"./module.ts\""), + c.comment(" "), + c.jsxAttribute("types"), + c.operator("="), + c.jsxAttributeStringLiteralValue("\"node\""), + c.comment(" "), + c.punctuation("/>")); \ No newline at end of file diff --git a/tests/cases/fourslash/syntacticClassificationsTripleSlash4.ts b/tests/cases/fourslash/syntacticClassificationsTripleSlash4.ts new file mode 100644 index 00000000000..e656c811377 --- /dev/null +++ b/tests/cases/fourslash/syntacticClassificationsTripleSlash4.ts @@ -0,0 +1,8 @@ +/// + +//// /// < + +var c = classification; +verify.syntacticClassificationsAre( + c.comment("/// "), + c.punctuation("<")); \ No newline at end of file diff --git a/tests/cases/fourslash/syntacticClassificationsTripleSlash5.ts b/tests/cases/fourslash/syntacticClassificationsTripleSlash5.ts new file mode 100644 index 00000000000..c6f1de38f28 --- /dev/null +++ b/tests/cases/fourslash/syntacticClassificationsTripleSlash5.ts @@ -0,0 +1,9 @@ +/// + +//// /// + +//// /// + +//// /// + +//// /// + +//// /// Date: Fri, 26 Jul 2019 11:03:31 -0700 Subject: [PATCH 07/15] Less aggressive reduction of intersection types --- src/compiler/checker.ts | 70 +++++++++++++++++++++++------------------ 1 file changed, 40 insertions(+), 30 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 0f8326c1fac..8ef7b3453a2 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -15310,7 +15310,7 @@ namespace ts { objectFlags & ObjectFlags.Reference && forEach((type).typeArguments, couldContainTypeVariables) || objectFlags & ObjectFlags.Anonymous && type.symbol && type.symbol.flags & (SymbolFlags.Function | SymbolFlags.Method | SymbolFlags.Class | SymbolFlags.TypeLiteral | SymbolFlags.ObjectLiteral) && type.symbol.declarations || objectFlags & ObjectFlags.Mapped || - type.flags & TypeFlags.UnionOrIntersection && couldUnionOrIntersectionContainTypeVariables(type)); + type.flags & TypeFlags.UnionOrIntersection && !(type.flags & TypeFlags.EnumLiteral) && couldUnionOrIntersectionContainTypeVariables(type)); } function couldUnionOrIntersectionContainTypeVariables(type: UnionOrIntersectionType): boolean { @@ -15487,37 +15487,47 @@ namespace ts { inferFromTypeArguments(source.aliasTypeArguments, target.aliasTypeArguments!, getAliasVariances(source.aliasSymbol)); return; } - if (source.flags & TypeFlags.Union && target.flags & TypeFlags.Union && !(source.flags & TypeFlags.EnumLiteral && target.flags & TypeFlags.EnumLiteral) || - source.flags & TypeFlags.Intersection && target.flags & TypeFlags.Intersection) { - // Source and target are both unions or both intersections. If source and target - // are the same type, just relate each constituent type to itself. - if (source === target) { - for (const t of (source).types) { - inferFromTypes(t, t); - } - return; + if (source === target && source.flags & TypeFlags.UnionOrIntersection) { + // When source and target are the same union or intersection type, just relate each constituent + // type to itself. + for (const t of (source).types) { + inferFromTypes(t, t); } - // First, infer between exactly matching source and target constituents and remove - // the matching types. Types exactly match when they are identical or, in union - // types, when the source is a literal and the target is the corresponding primitive. - const matching = target.flags & TypeFlags.Union ? isTypeOrBaseIdenticalTo : isTypeIdenticalTo; - const [tempSources, tempTargets] = inferFromMatchingTypes((source).types, (target).types, matching); - // Next, infer between closely matching source and target constituents and remove - // the matching types. Types closely match when they are instantiations of the same - // object type or instantiations of the same type alias. - const [sources, targets] = inferFromMatchingTypes(tempSources, tempTargets, isTypeCloselyMatchedBy); - if (sources.length === 0 || targets.length === 0) { - return; - } - source = source.flags & TypeFlags.Union ? getUnionType(sources) : getIntersectionType(sources); - target = target.flags & TypeFlags.Union ? getUnionType(targets) : getIntersectionType(targets); + return; } - else if (target.flags & TypeFlags.Union && !(target.flags & TypeFlags.EnumLiteral) || target.flags & TypeFlags.Intersection) { - // This block of code is an optimized version of the block above for the simpler case - // of a singleton source type. - const matching = target.flags & TypeFlags.Union ? isTypeOrBaseIdenticalTo : isTypeIdenticalTo; - if (inferFromMatchingType(source, (target).types, matching)) return; - if (inferFromMatchingType(source, (target).types, isTypeCloselyMatchedBy)) return; + if (target.flags & TypeFlags.Union) { + if (source.flags & TypeFlags.Union) { + // First, infer between identically matching source and target constituents and remove the + // matching types. + const [tempSources, tempTargets] = inferFromMatchingTypes((source).types, (target).types, isTypeOrBaseIdenticalTo); + // Next, infer between closely matching source and target constituents and remove + // the matching types. Types closely match when they are instantiations of the same + // object type or instantiations of the same type alias. + const [sources, targets] = inferFromMatchingTypes(tempSources, tempTargets, isTypeCloselyMatchedBy); + if (sources.length === 0 || targets.length === 0) { + return; + } + source = getUnionType(sources); + target = getUnionType(targets); + } + else { + if (inferFromMatchingType(source, (target).types, isTypeOrBaseIdenticalTo)) return; + if (inferFromMatchingType(source, (target).types, isTypeCloselyMatchedBy)) return; + } + } + else if (target.flags & TypeFlags.Intersection && some((target).types, t => !!getInferenceInfoForType(t))) { + if (source.flags & TypeFlags.Intersection) { + // Infer between identically matching source and target constituents and remove the matching types. + const [sources, targets] = inferFromMatchingTypes((source).types, (target).types, isTypeIdenticalTo); + if (sources.length === 0 || targets.length === 0) { + return; + } + source = getIntersectionType(sources); + target = getIntersectionType(targets); + } + else if (!(source.flags & TypeFlags.Union)) { + if (inferFromMatchingType(source, (target).types, isTypeIdenticalTo)) return; + } } else if (target.flags & (TypeFlags.IndexedAccess | TypeFlags.Substitution)) { target = getActualTypeVariable(target); From bb87332e73a1024dd3aa1b0fef18575cb504057d Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Fri, 26 Jul 2019 13:12:44 -0700 Subject: [PATCH 08/15] Add more comments --- src/compiler/checker.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 8ef7b3453a2..a69751673f6 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -15516,6 +15516,10 @@ namespace ts { } } else if (target.flags & TypeFlags.Intersection && some((target).types, t => !!getInferenceInfoForType(t))) { + // We reduce intersection types only when they contain naked type parameters. For example, when + // inferring from 'string[] & { extra: any }' to 'string[] & T' we want to remove string[] and + // infer { extra: any } for T. But when inferring to 'string[] & Iterable' we want to keep the + // string[] on the source side and infer string for T. if (source.flags & TypeFlags.Intersection) { // Infer between identically matching source and target constituents and remove the matching types. const [sources, targets] = inferFromMatchingTypes((source).types, (target).types, isTypeIdenticalTo); From ec38799e2a1a9df776882e20d89604c85ec3015f Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Fri, 26 Jul 2019 13:17:00 -0700 Subject: [PATCH 09/15] Add more tests --- .../unionAndIntersectionInference3.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/cases/conformance/types/typeRelationships/typeInference/unionAndIntersectionInference3.ts b/tests/cases/conformance/types/typeRelationships/typeInference/unionAndIntersectionInference3.ts index 17057de2b84..d64b1973695 100644 --- a/tests/cases/conformance/types/typeRelationships/typeInference/unionAndIntersectionInference3.ts +++ b/tests/cases/conformance/types/typeRelationships/typeInference/unionAndIntersectionInference3.ts @@ -40,3 +40,17 @@ declare let g2: (x: Foo2 | Bar2) => Promise; g1 = g2; g2 = g1; + +// Repro from #32572 + +declare function foo1(obj: string[] & Iterable): T; +declare function foo2(obj: string[] & T): T; + +declare let sa: string[]; +declare let sx: string[] & { extra: number }; + +let x1 = foo1(sa); // string +let y1 = foo1(sx); // string + +let x2 = foo2(sa); // unknown +let y2 = foo2(sx); // { extra: number } From 1ea4008120a20c4cca416af2096c5f3a46da7063 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Fri, 26 Jul 2019 13:17:06 -0700 Subject: [PATCH 10/15] Accept new baselines --- .../unionAndIntersectionInference3.js | 18 ++++++++ .../unionAndIntersectionInference3.symbols | 44 +++++++++++++++++++ .../unionAndIntersectionInference3.types | 41 +++++++++++++++++ 3 files changed, 103 insertions(+) diff --git a/tests/baselines/reference/unionAndIntersectionInference3.js b/tests/baselines/reference/unionAndIntersectionInference3.js index c9f5cffa1f7..415d98220a5 100644 --- a/tests/baselines/reference/unionAndIntersectionInference3.js +++ b/tests/baselines/reference/unionAndIntersectionInference3.js @@ -38,6 +38,20 @@ declare let g2: (x: Foo2 | Bar2) => Promise; g1 = g2; g2 = g1; + +// Repro from #32572 + +declare function foo1(obj: string[] & Iterable): T; +declare function foo2(obj: string[] & T): T; + +declare let sa: string[]; +declare let sx: string[] & { extra: number }; + +let x1 = foo1(sa); // string +let y1 = foo1(sx); // string + +let x2 = foo2(sa); // unknown +let y2 = foo2(sx); // { extra: number } //// [unionAndIntersectionInference3.js] @@ -52,3 +66,7 @@ f1 = f2; f2 = f1; g1 = g2; g2 = g1; +let x1 = foo1(sa); // string +let y1 = foo1(sx); // string +let x2 = foo2(sa); // unknown +let y2 = foo2(sx); // { extra: number } diff --git a/tests/baselines/reference/unionAndIntersectionInference3.symbols b/tests/baselines/reference/unionAndIntersectionInference3.symbols index b854ee1ce42..1d237951b4f 100644 --- a/tests/baselines/reference/unionAndIntersectionInference3.symbols +++ b/tests/baselines/reference/unionAndIntersectionInference3.symbols @@ -161,3 +161,47 @@ g2 = g1; >g2 : Symbol(g2, Decl(unionAndIntersectionInference3.ts, 35, 11)) >g1 : Symbol(g1, Decl(unionAndIntersectionInference3.ts, 34, 11)) +// Repro from #32572 + +declare function foo1(obj: string[] & Iterable): T; +>foo1 : Symbol(foo1, Decl(unionAndIntersectionInference3.ts, 38, 8)) +>T : Symbol(T, Decl(unionAndIntersectionInference3.ts, 42, 22)) +>obj : Symbol(obj, Decl(unionAndIntersectionInference3.ts, 42, 25)) +>Iterable : Symbol(Iterable, Decl(lib.es2015.iterable.d.ts, --, --)) +>T : Symbol(T, Decl(unionAndIntersectionInference3.ts, 42, 22)) +>T : Symbol(T, Decl(unionAndIntersectionInference3.ts, 42, 22)) + +declare function foo2(obj: string[] & T): T; +>foo2 : Symbol(foo2, Decl(unionAndIntersectionInference3.ts, 42, 57)) +>T : Symbol(T, Decl(unionAndIntersectionInference3.ts, 43, 22)) +>obj : Symbol(obj, Decl(unionAndIntersectionInference3.ts, 43, 25)) +>T : Symbol(T, Decl(unionAndIntersectionInference3.ts, 43, 22)) +>T : Symbol(T, Decl(unionAndIntersectionInference3.ts, 43, 22)) + +declare let sa: string[]; +>sa : Symbol(sa, Decl(unionAndIntersectionInference3.ts, 45, 11)) + +declare let sx: string[] & { extra: number }; +>sx : Symbol(sx, Decl(unionAndIntersectionInference3.ts, 46, 11)) +>extra : Symbol(extra, Decl(unionAndIntersectionInference3.ts, 46, 28)) + +let x1 = foo1(sa); // string +>x1 : Symbol(x1, Decl(unionAndIntersectionInference3.ts, 48, 3)) +>foo1 : Symbol(foo1, Decl(unionAndIntersectionInference3.ts, 38, 8)) +>sa : Symbol(sa, Decl(unionAndIntersectionInference3.ts, 45, 11)) + +let y1 = foo1(sx); // string +>y1 : Symbol(y1, Decl(unionAndIntersectionInference3.ts, 49, 3)) +>foo1 : Symbol(foo1, Decl(unionAndIntersectionInference3.ts, 38, 8)) +>sx : Symbol(sx, Decl(unionAndIntersectionInference3.ts, 46, 11)) + +let x2 = foo2(sa); // unknown +>x2 : Symbol(x2, Decl(unionAndIntersectionInference3.ts, 51, 3)) +>foo2 : Symbol(foo2, Decl(unionAndIntersectionInference3.ts, 42, 57)) +>sa : Symbol(sa, Decl(unionAndIntersectionInference3.ts, 45, 11)) + +let y2 = foo2(sx); // { extra: number } +>y2 : Symbol(y2, Decl(unionAndIntersectionInference3.ts, 52, 3)) +>foo2 : Symbol(foo2, Decl(unionAndIntersectionInference3.ts, 42, 57)) +>sx : Symbol(sx, Decl(unionAndIntersectionInference3.ts, 46, 11)) + diff --git a/tests/baselines/reference/unionAndIntersectionInference3.types b/tests/baselines/reference/unionAndIntersectionInference3.types index acbca0a1eae..fb507474321 100644 --- a/tests/baselines/reference/unionAndIntersectionInference3.types +++ b/tests/baselines/reference/unionAndIntersectionInference3.types @@ -94,3 +94,44 @@ g2 = g1; >g2 : (x: Foo2 | Bar2) => Promise >g1 : (x: Foo2 | Bar2) => Promise +// Repro from #32572 + +declare function foo1(obj: string[] & Iterable): T; +>foo1 : (obj: string[] & Iterable) => T +>obj : string[] & Iterable + +declare function foo2(obj: string[] & T): T; +>foo2 : (obj: string[] & T) => T +>obj : string[] & T + +declare let sa: string[]; +>sa : string[] + +declare let sx: string[] & { extra: number }; +>sx : string[] & { extra: number; } +>extra : number + +let x1 = foo1(sa); // string +>x1 : string +>foo1(sa) : string +>foo1 : (obj: string[] & Iterable) => T +>sa : string[] + +let y1 = foo1(sx); // string +>y1 : string +>foo1(sx) : string +>foo1 : (obj: string[] & Iterable) => T +>sx : string[] & { extra: number; } + +let x2 = foo2(sa); // unknown +>x2 : unknown +>foo2(sa) : unknown +>foo2 : (obj: string[] & T) => T +>sa : string[] + +let y2 = foo2(sx); // { extra: number } +>y2 : { extra: number; } +>foo2(sx) : { extra: number; } +>foo2 : (obj: string[] & T) => T +>sx : string[] & { extra: number; } + From a9e0a7766e30eff61f76ca85b380e65f45c8eb12 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Sat, 27 Jul 2019 08:50:26 -0700 Subject: [PATCH 11/15] Record full inference status in visitation cache --- src/compiler/checker.ts | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index a69751673f6..27c8a027cbc 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -15462,7 +15462,7 @@ namespace ts { let visited: Map; let bivariant = false; let propagationType: Type; - let inferenceCount = 0; + let inferenceMatch = false; let inferenceIncomplete = false; let allowComplexConstraintInference = true; inferFromTypes(originalSource, originalTarget); @@ -15576,7 +15576,7 @@ namespace ts { clearCachedInferences(inferences); } } - inferenceCount++; + inferenceMatch = true; return; } else { @@ -15668,15 +15668,21 @@ namespace ts { function invokeOnce(source: Type, target: Type, action: (source: Type, target: Type) => void) { const key = source.id + "," + target.id; - const count = visited && visited.get(key); - if (count !== undefined) { - inferenceCount += count; + const status = visited && visited.get(key); + if (status !== undefined) { + if (status & 1) inferenceMatch = true; + if (status & 2) inferenceIncomplete = true; return; } (visited || (visited = createMap())).set(key, 0); - const startCount = inferenceCount; + const saveInferenceMatch = inferenceMatch; + const saveInferenceIncomplete = inferenceIncomplete; + inferenceMatch = false; + inferenceIncomplete = false; action(source, target); - visited.set(key, inferenceCount - startCount); + visited.set(key, (inferenceMatch ? 1 : 0) | (inferenceIncomplete ? 2 : 0)); + inferenceMatch = inferenceMatch || saveInferenceMatch; + inferenceIncomplete = inferenceIncomplete || saveInferenceIncomplete; } function inferFromMatchingType(source: Type, targets: Type[], matches: (s: Type, t: Type) => boolean) { @@ -15759,9 +15765,11 @@ namespace ts { } else { for (let i = 0; i < sources.length; i++) { - const count = inferenceCount; + const saveInferenceMatch = inferenceMatch; + inferenceMatch = false; inferFromTypes(sources[i], t); - if (count !== inferenceCount) matched[i] = true; + if (inferenceMatch) matched[i] = true; + inferenceMatch = inferenceMatch || saveInferenceMatch; } } } From 58ff76abf663190a91ada6e3f23e9b3fed417af0 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Sun, 28 Jul 2019 09:01:11 -0700 Subject: [PATCH 12/15] Properly instantiate contextual type for object literal methods --- src/compiler/checker.ts | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index f8242ed6df7..1ad92eebc21 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -19099,10 +19099,13 @@ namespace ts { // Return the contextual type for a given expression node. During overload resolution, a contextual type may temporarily // be "pushed" onto a node using the contextualType property. - function getApparentTypeOfContextualType(node: Expression, contextFlags?: ContextFlags): Type | undefined { - const contextualType = instantiateContextualType(getContextualType(node, contextFlags), node, contextFlags); - if (contextualType) { - const apparentType = mapType(contextualType, getApparentType, /*noReductions*/ true); + function getApparentTypeOfContextualType(node: Expression | MethodDeclaration, contextFlags?: ContextFlags): Type | undefined { + const contextualType = isObjectLiteralMethod(node) ? + getContextualTypeForObjectLiteralMethod(node, contextFlags) : + getContextualType(node, contextFlags); + const instantiatedType = instantiateContextualType(contextualType, node, contextFlags); + if (instantiatedType) { + const apparentType = mapType(instantiatedType, getApparentType, /*noReductions*/ true); if (apparentType.flags & TypeFlags.Union) { if (isObjectLiteralExpression(node)) { return discriminateContextualTypeByObjectMembers(node, apparentType as UnionType); @@ -19426,9 +19429,7 @@ namespace ts { if (typeTagSignature) { return typeTagSignature; } - const type = isObjectLiteralMethod(node) ? - getContextualTypeForObjectLiteralMethod(node, ContextFlags.Signature) : - getApparentTypeOfContextualType(node, ContextFlags.Signature); + const type = getApparentTypeOfContextualType(node, ContextFlags.Signature); if (!type) { return undefined; } From a717d3ab44b2cacc9e0fb36861bbe7c428bba6fc Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Sun, 28 Jul 2019 09:05:57 -0700 Subject: [PATCH 13/15] Add regression test --- tests/cases/compiler/instantiateContextualTypes.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/cases/compiler/instantiateContextualTypes.ts b/tests/cases/compiler/instantiateContextualTypes.ts index 3165011ecff..4059bd5202e 100644 --- a/tests/cases/compiler/instantiateContextualTypes.ts +++ b/tests/cases/compiler/instantiateContextualTypes.ts @@ -174,3 +174,13 @@ class Interesting { declare function invoke(f: () => T): T; let xx: 0 | 1 | 2 = invoke(() => 1); + +// Repro from #32416 + +declare function assignPartial(target: T, partial: Partial): T; + +let obj = { + foo(bar: string) {} +} + +assignPartial(obj, { foo(...args) {} }); // args has type [string] From 4a17581f67a0c0cd413adcd7ce0e0ffe30698122 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Sun, 28 Jul 2019 09:06:04 -0700 Subject: [PATCH 14/15] Accept new baselines --- .../reference/instantiateContextualTypes.js | 14 ++++++++++ .../instantiateContextualTypes.symbols | 26 +++++++++++++++++++ .../instantiateContextualTypes.types | 24 +++++++++++++++++ 3 files changed, 64 insertions(+) diff --git a/tests/baselines/reference/instantiateContextualTypes.js b/tests/baselines/reference/instantiateContextualTypes.js index 9de6bfb612c..46d87cb1153 100644 --- a/tests/baselines/reference/instantiateContextualTypes.js +++ b/tests/baselines/reference/instantiateContextualTypes.js @@ -172,6 +172,16 @@ class Interesting { declare function invoke(f: () => T): T; let xx: 0 | 1 | 2 = invoke(() => 1); + +// Repro from #32416 + +declare function assignPartial(target: T, partial: Partial): T; + +let obj = { + foo(bar: string) {} +} + +assignPartial(obj, { foo(...args) {} }); // args has type [string] //// [instantiateContextualTypes.js] @@ -222,3 +232,7 @@ class Interesting { } } let xx = invoke(() => 1); +let obj = { + foo(bar) { } +}; +assignPartial(obj, { foo(...args) { } }); // args has type [string] diff --git a/tests/baselines/reference/instantiateContextualTypes.symbols b/tests/baselines/reference/instantiateContextualTypes.symbols index 1250edd585b..d3e8a7a317c 100644 --- a/tests/baselines/reference/instantiateContextualTypes.symbols +++ b/tests/baselines/reference/instantiateContextualTypes.symbols @@ -481,3 +481,29 @@ let xx: 0 | 1 | 2 = invoke(() => 1); >xx : Symbol(xx, Decl(instantiateContextualTypes.ts, 172, 3)) >invoke : Symbol(invoke, Decl(instantiateContextualTypes.ts, 166, 1)) +// Repro from #32416 + +declare function assignPartial(target: T, partial: Partial): T; +>assignPartial : Symbol(assignPartial, Decl(instantiateContextualTypes.ts, 172, 36)) +>T : Symbol(T, Decl(instantiateContextualTypes.ts, 176, 31)) +>target : Symbol(target, Decl(instantiateContextualTypes.ts, 176, 34)) +>T : Symbol(T, Decl(instantiateContextualTypes.ts, 176, 31)) +>partial : Symbol(partial, Decl(instantiateContextualTypes.ts, 176, 44)) +>Partial : Symbol(Partial, Decl(lib.es5.d.ts, --, --)) +>T : Symbol(T, Decl(instantiateContextualTypes.ts, 176, 31)) +>T : Symbol(T, Decl(instantiateContextualTypes.ts, 176, 31)) + +let obj = { +>obj : Symbol(obj, Decl(instantiateContextualTypes.ts, 178, 3)) + + foo(bar: string) {} +>foo : Symbol(foo, Decl(instantiateContextualTypes.ts, 178, 11)) +>bar : Symbol(bar, Decl(instantiateContextualTypes.ts, 179, 6)) +} + +assignPartial(obj, { foo(...args) {} }); // args has type [string] +>assignPartial : Symbol(assignPartial, Decl(instantiateContextualTypes.ts, 172, 36)) +>obj : Symbol(obj, Decl(instantiateContextualTypes.ts, 178, 3)) +>foo : Symbol(foo, Decl(instantiateContextualTypes.ts, 182, 20)) +>args : Symbol(args, Decl(instantiateContextualTypes.ts, 182, 25)) + diff --git a/tests/baselines/reference/instantiateContextualTypes.types b/tests/baselines/reference/instantiateContextualTypes.types index 88e6ca7e4dd..b5317b6f756 100644 --- a/tests/baselines/reference/instantiateContextualTypes.types +++ b/tests/baselines/reference/instantiateContextualTypes.types @@ -422,3 +422,27 @@ let xx: 0 | 1 | 2 = invoke(() => 1); >() => 1 : () => 1 >1 : 1 +// Repro from #32416 + +declare function assignPartial(target: T, partial: Partial): T; +>assignPartial : (target: T, partial: Partial) => T +>target : T +>partial : Partial + +let obj = { +>obj : { foo(bar: string): void; } +>{ foo(bar: string) {}} : { foo(bar: string): void; } + + foo(bar: string) {} +>foo : (bar: string) => void +>bar : string +} + +assignPartial(obj, { foo(...args) {} }); // args has type [string] +>assignPartial(obj, { foo(...args) {} }) : { foo(bar: string): void; } +>assignPartial : (target: T, partial: Partial) => T +>obj : { foo(bar: string): void; } +>{ foo(...args) {} } : { foo(bar: string): void; } +>foo : (bar: string) => void +>args : [string] + From b963e1a2a7e3b1056ee2552927fa08fcc51e4c7d Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Mon, 29 Jul 2019 10:33:43 -0700 Subject: [PATCH 15/15] Update LKG (#32578) * Update LKG * Add @types/node version bump * Small paatches/casts to be compatible with latest node * Accept API baseline update * Make internal NodeBuffer compatable with latest Buffer * Why do we even have an internal buffer type * Sync up internal buffer type better * Fix lint * Readd mroe missing Buffer methods --- lib/enu/diagnosticMessages.generated.json.lcg | 424 +- lib/it/diagnosticMessages.generated.json | 4 +- lib/ja/diagnosticMessages.generated.json | 4 +- lib/ko/diagnosticMessages.generated.json | 140 +- lib/lib.dom.d.ts | 4022 ++- lib/lib.dom.iterable.d.ts | 111 +- lib/lib.es2015.collection.d.ts | 2 +- lib/lib.es2015.core.d.ts | 18 +- lib/lib.es2015.generator.d.ts | 10 +- lib/lib.es2015.iterable.d.ts | 26 +- lib/lib.es2015.promise.d.ts | 70 +- lib/lib.es2018.asyncgenerator.d.ts | 79 + lib/lib.es2018.asynciterable.d.ts | 9 +- lib/lib.es2018.d.ts | 1 + lib/lib.es2019.d.ts | 1 + lib/lib.es2019.object.d.ts | 35 + lib/lib.es2019.string.d.ts | 4 +- lib/lib.es2020.d.ts | 23 + lib/lib.es2020.full.d.ts | 25 + lib/lib.es2020.string.d.ts | 30 + lib/lib.es2020.symbol.wellknown.d.ts | 39 + lib/lib.es5.d.ts | 81 +- lib/lib.esnext.bigint.d.ts | 8 +- lib/lib.webworker.d.ts | 2245 +- lib/pl/diagnosticMessages.generated.json | 4 +- lib/protocol.d.ts | 57 +- lib/ru/diagnosticMessages.generated.json | 4 +- lib/tsc.js | 20474 ++++++----- lib/tsserver.js | 30143 +++++++++------- lib/tsserverlibrary.d.ts | 861 +- lib/tsserverlibrary.js | 30124 ++++++++------- lib/typescript.d.ts | 793 +- lib/typescript.js | 29662 ++++++++------- lib/typescriptServices.d.ts | 793 +- lib/typescriptServices.js | 29662 ++++++++------- lib/typingsInstaller.js | 23362 ++++++------ lib/zh-cn/diagnosticMessages.generated.json | 2 +- package.json | 2 +- src/compiler/sys.ts | 114 +- src/harness/harness.ts | 2 +- src/testRunner/externalCompileRunner.ts | 2 +- .../reference/api/tsserverlibrary.d.ts | 1124 +- tests/baselines/reference/api/typescript.d.ts | 1055 +- 43 files changed, 100855 insertions(+), 74796 deletions(-) create mode 100644 lib/lib.es2018.asyncgenerator.d.ts create mode 100644 lib/lib.es2019.object.d.ts create mode 100644 lib/lib.es2020.d.ts create mode 100644 lib/lib.es2020.full.d.ts create mode 100644 lib/lib.es2020.string.d.ts create mode 100644 lib/lib.es2020.symbol.wellknown.d.ts diff --git a/lib/enu/diagnosticMessages.generated.json.lcg b/lib/enu/diagnosticMessages.generated.json.lcg index 0b66fd7760c..77e5d6f2236 100644 --- a/lib/enu/diagnosticMessages.generated.json.lcg +++ b/lib/enu/diagnosticMessages.generated.json.lcg @@ -141,9 +141,9 @@ - + - + @@ -189,12 +189,6 @@ - - - - - - @@ -675,12 +669,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + @@ -849,6 +867,12 @@ + + + + + + @@ -867,6 +891,12 @@ + + + + + + @@ -1209,6 +1239,12 @@ + + + + + + @@ -1413,18 +1449,18 @@ - - - - - - + + + + + + @@ -1593,12 +1629,6 @@ - - - - - - @@ -1617,6 +1647,24 @@ + + + + + + + + + + + + + + + + + + @@ -1683,12 +1731,6 @@ - - - - - - @@ -1863,6 +1905,12 @@ + + + + + + @@ -2037,6 +2085,12 @@ + + + + + + @@ -2061,12 +2115,6 @@ - - - - - - @@ -2151,6 +2199,12 @@ + + + + + + @@ -2187,6 +2241,12 @@ + + + + + + {1}'?]]> @@ -2199,6 +2259,12 @@ + + + + + + @@ -2421,6 +2487,24 @@ + + + + + + + + + + + + + + + + + + @@ -2433,6 +2517,12 @@ + + + + + + @@ -2663,7 +2753,7 @@ - + @@ -2811,6 +2901,24 @@ + + + + + + + + + + + + + + + + + + @@ -2865,9 +2973,9 @@ - + - + @@ -2925,6 +3033,12 @@ + + + + + + @@ -2955,12 +3069,6 @@ - - - - - - @@ -3033,18 +3141,6 @@ - - - - - - - - - - - - @@ -3063,9 +3159,9 @@ - + - + @@ -3333,6 +3429,12 @@ + + + + + + @@ -3597,6 +3699,12 @@ + + + + + + @@ -3795,6 +3903,12 @@ + + + + + + @@ -3891,6 +4005,12 @@ + + + + + + @@ -3945,6 +4065,24 @@ + + + + + + + + + + + + + + + + + + @@ -3963,6 +4101,18 @@ + + + + + + + + + + + + @@ -3987,6 +4137,18 @@ + + + + + + + + + + + + @@ -4173,6 +4335,12 @@ + + + + + + @@ -4233,6 +4401,12 @@ + + + + + + @@ -4503,6 +4677,12 @@ + + + + + + @@ -4587,12 +4767,6 @@ - - - - - - @@ -4911,6 +5085,12 @@ + + + + + + @@ -4959,6 +5139,12 @@ + + + + + + @@ -5601,6 +5787,18 @@ + + + + + + + + + + + + @@ -5679,6 +5877,12 @@ + + + + + + @@ -5715,6 +5919,18 @@ + + + + + + + + + + + + @@ -5889,6 +6105,12 @@ + + + + + + @@ -5901,15 +6123,15 @@ - + - + - + - + @@ -5955,6 +6177,18 @@ + + + + + + + + + + + + @@ -5967,6 +6201,12 @@ + + + + + + @@ -5991,6 +6231,12 @@ + + + + + + @@ -6045,6 +6291,18 @@ + + + + + + + + + + + + @@ -6375,6 +6633,12 @@ + + + + + + @@ -6717,6 +6981,12 @@ + + + + + + @@ -6891,6 +7161,12 @@ + + + + + + @@ -6915,6 +7191,12 @@ + + + + + + @@ -7137,6 +7419,12 @@ + + + + + + @@ -7227,6 +7515,12 @@ + + + + + + diff --git a/lib/it/diagnosticMessages.generated.json b/lib/it/diagnosticMessages.generated.json index 9f8ef7d48f4..51981810ba2 100644 --- a/lib/it/diagnosticMessages.generated.json +++ b/lib/it/diagnosticMessages.generated.json @@ -355,7 +355,7 @@ "Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature_7017": "L'elemento contiene implicitamente un tipo 'any' perché al tipo '{0}' non è assegnata alcuna firma dell'indice.", "Emit_a_UTF_8_Byte_Order_Mark_BOM_in_the_beginning_of_output_files_6164": "Crea un BOM (Byte Order Mark) UTF-8 all'inizio dei file di output.", "Emit_a_single_file_with_source_maps_instead_of_having_a_separate_file_6151": "Crea un unico file con i mapping di origine invece di file separati.", - "Emit_the_source_alongside_the_sourcemaps_within_a_single_file_requires_inlineSourceMap_or_sourceMap__6152": "Crea l'origine unitamente alle mappe di origine all'interno di un unico file. Richiede l'impostazione di '--inlineSourceMap' o '--sourceMap'.", + "Emit_the_source_alongside_the_sourcemaps_within_a_single_file_requires_inlineSourceMap_or_sourceMap__6152": "Crea l'origine unitamente ai mapping di origine all'interno di un unico file. Richiede l'impostazione di '--inlineSourceMap' o '--sourceMap'.", "Enable_all_strict_type_checking_options_6180": "Abilita tutte le opzioni per i controlli del tipo strict.", "Enable_project_compilation_6302": "Abilitare la compilazione dei progetti", "Enable_strict_checking_of_function_types_6186": "Abilita il controllo tassativo dei tipi funzione.", @@ -445,7 +445,7 @@ "Function_overload_must_be_static_2387": "L'overload della funzione deve essere statico.", "Function_overload_must_not_be_static_2388": "L'overload della funzione non deve essere statico.", "Generate_get_and_set_accessors_95046": "Generare le funzioni di accesso 'get' e 'set'", - "Generates_a_sourcemap_for_each_corresponding_d_ts_file_6000": "Genera un sourcemap per ogni file '.d.ts' corrispondente.", + "Generates_a_sourcemap_for_each_corresponding_d_ts_file_6000": "Genera un mapping di origine per ogni file '.d.ts' corrispondente.", "Generates_corresponding_d_ts_file_6002": "Genera il file '.d.ts' corrispondente.", "Generates_corresponding_map_file_6043": "Genera il file '.map' corrispondente.", "Generator_implicitly_has_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_typ_7025": "Il tipo del generatore è implicitamente '{0}' perché non contiene alcun valore. Provare a specificare un tipo restituito.", diff --git a/lib/ja/diagnosticMessages.generated.json b/lib/ja/diagnosticMessages.generated.json index 6877a89c753..d3029982ca6 100644 --- a/lib/ja/diagnosticMessages.generated.json +++ b/lib/ja/diagnosticMessages.generated.json @@ -355,7 +355,7 @@ "Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature_7017": "型 '{0}' にはインデックス シグネチャがないため、要素は暗黙的に 'any' 型になります。", "Emit_a_UTF_8_Byte_Order_Mark_BOM_in_the_beginning_of_output_files_6164": "出力ファイルの最初に UTF-8 バイト順マーク(BOM) を生成します。", "Emit_a_single_file_with_source_maps_instead_of_having_a_separate_file_6151": "個々のファイルを持つ代わりに、複数のソース マップを含む単一ファイルを生成します。", - "Emit_the_source_alongside_the_sourcemaps_within_a_single_file_requires_inlineSourceMap_or_sourceMap__6152": "単一ファイル内で sourcemap と共にソースを生成します。'--inlineSourceMap' または '--sourceMap' を設定する必要があります。", + "Emit_the_source_alongside_the_sourcemaps_within_a_single_file_requires_inlineSourceMap_or_sourceMap__6152": "単一ファイル内でソースマップと共にソースを生成します。'--inlineSourceMap' または '--sourceMap' を設定する必要があります。", "Enable_all_strict_type_checking_options_6180": "厳密な型チェックのオプションをすべて有効にします。", "Enable_project_compilation_6302": "プロジェクトのコンパイルを有効にします", "Enable_strict_checking_of_function_types_6186": "関数の型の厳密なチェックを有効にします。", @@ -445,7 +445,7 @@ "Function_overload_must_be_static_2387": "関数のオーバーロードは静的でなければなりません。", "Function_overload_must_not_be_static_2388": "関数のオーバーロードは静的にはできせん。", "Generate_get_and_set_accessors_95046": "'get' および 'set' アクセサーの生成", - "Generates_a_sourcemap_for_each_corresponding_d_ts_file_6000": "対応する各 '.d.ts' ファイルに sourcemap を生成します。", + "Generates_a_sourcemap_for_each_corresponding_d_ts_file_6000": "対応する各 '.d.ts' ファイルにソースマップを生成します。", "Generates_corresponding_d_ts_file_6002": "対応する '.d.ts' ファイルを生成します。", "Generates_corresponding_map_file_6043": "対応する '.map' ファイルを生成します。", "Generator_implicitly_has_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_typ_7025": "ジェネレーターは値を生成しないため、暗黙的に型 '{0}' になります。戻り値の型を指定することを検討してください。", diff --git a/lib/ko/diagnosticMessages.generated.json b/lib/ko/diagnosticMessages.generated.json index a1b1320115a..abda4ace91f 100644 --- a/lib/ko/diagnosticMessages.generated.json +++ b/lib/ko/diagnosticMessages.generated.json @@ -309,7 +309,7 @@ "Declare_static_property_0_90027": "'{0}' 정적 속성 선언", "Decorators_are_not_valid_here_1206": "데코레이터는 여기에 사용할 수 없습니다.", "Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name_1207": "동일한 이름의 여러 get/set 접근자에 데코레이터를 적용할 수 없습니다.", - "Default_export_of_the_module_has_or_is_using_private_name_0_4082": "모듈의 기본 내보내기에서 전용 이름 '{0}'을(를) 가지고 있거나 사용 중입니다.", + "Default_export_of_the_module_has_or_is_using_private_name_0_4082": "모듈의 기본 내보내기에서 프라이빗 이름 '{0}'을(를) 가지고 있거나 사용 중입니다.", "Delete_all_unused_declarations_95024": "사용하지 않는 선언 모두 삭제", "Delete_the_outputs_of_all_projects_6365": "모든 프로젝트의 출력 삭제", "Deprecated_Use_jsxFactory_instead_Specify_the_object_invoked_for_createElement_when_targeting_react__6084": "[사용되지 않음] 대신 '--jsxFactory'를 사용합니다. 'react' JSX 내보내기를 대상으로 할 경우 createElement에 대해 호출되는 개체를 지정합니다.", @@ -395,10 +395,10 @@ "Export_declarations_are_not_permitted_in_a_namespace_1194": "네임스페이스에서는 내보내기 선언이 허용되지 않습니다.", "Exported_external_package_typings_file_0_is_not_a_module_Please_contact_the_package_author_to_update_2656": "내보낸 외부 패키지 입력 항목 파일 '{0}'은(는) 모듈이 아닙니다. 패키지 작성자에게 문의하여 패키지 정의를 업데이트하세요.", "Exported_external_package_typings_file_cannot_contain_tripleslash_references_Please_contact_the_pack_2654": "내보낸 외부 패키지 입력 항목 파일에는 삼중 슬래시 참조가 포함될 수 없습니다. 패키지 작성자에게 문의하여 패키지 정의를 업데이트하세요.", - "Exported_type_alias_0_has_or_is_using_private_name_1_4081": "내보낸 형식 별칭 '{0}'은(는) '{1}' 전용 이름을 포함하거나 사용 중입니다.", + "Exported_type_alias_0_has_or_is_using_private_name_1_4081": "내보낸 형식 별칭 '{0}'은(는) '{1}' 프라이빗 이름을 포함하거나 사용 중입니다.", "Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named_4023": "내보낸 변수 '{0}'이(가) 외부 모듈 {2}의 '{1}' 이름을 가지고 있거나 사용 중이지만 명명할 수 없습니다.", - "Exported_variable_0_has_or_is_using_name_1_from_private_module_2_4024": "내보낸 변수 '{0}'이(가) 전용 모듈 '{2}'의 '{1}' 이름을 가지고 있거나 사용 중입니다.", - "Exported_variable_0_has_or_is_using_private_name_1_4025": "내보낸 변수 '{0}'이(가) 전용 이름 '{1}'을(를) 가지고 있거나 사용 중입니다.", + "Exported_variable_0_has_or_is_using_name_1_from_private_module_2_4024": "내보낸 변수 '{0}'이(가) 프라이빗 모듈 '{2}'의 '{1}' 이름을 가지고 있거나 사용 중입니다.", + "Exported_variable_0_has_or_is_using_private_name_1_4025": "내보낸 변수 '{0}'이(가) 프라이빗 이름 '{1}'을(를) 가지고 있거나 사용 중입니다.", "Exports_and_export_assignments_are_not_permitted_in_module_augmentations_2666": "내보내기 및 내보내기 할당는 모듈 확대에서 허용되지 않습니다.", "Expression_expected_1109": "식이 필요합니다.", "Expression_or_comma_expected_1137": "식 또는 쉼표가 필요합니다.", @@ -471,10 +471,10 @@ "Implement_all_unimplemented_interfaces_95032": "구현되지 않은 인터페이스 모두 구현", "Implement_inherited_abstract_class_90007": "상속된 추상 클래스 구현", "Implement_interface_0_90006": "'{0}' 인터페이스 구현", - "Implements_clause_of_exported_class_0_has_or_is_using_private_name_1_4019": "내보낸 클래스 '{0}'의 Implements 절이 전용 이름 '{1}'을(를) 가지고 있거나 사용 중입니다.", + "Implements_clause_of_exported_class_0_has_or_is_using_private_name_1_4019": "내보낸 클래스 '{0}'의 Implements 절이 프라이빗 이름 '{1}'을(를) 가지고 있거나 사용 중입니다.", "Import_0_from_module_1_90013": "\"{1}\" 모듈에서 '{0}' 가져오기", "Import_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_import_Asterisk_as_1202": "ECMAScript 모듈을 대상으로 하는 경우 할당 가져오기를 사용할 수 없습니다. 대신 'import * as ns from \"mod\"', 'import {a} from \"mod\"', 'import d from \"mod\"' 또는 다른 모듈 형식 사용을 고려하세요.", - "Import_declaration_0_is_using_private_name_1_4000": "가져오기 선언 '{0}'이(가) 전용 이름 '{1}'을(를) 사용하고 있습니다.", + "Import_declaration_0_is_using_private_name_1_4000": "가져오기 선언 '{0}'이(가) 프라이빗 이름 '{1}'을(를) 사용하고 있습니다.", "Import_declaration_conflicts_with_local_declaration_of_0_2440": "가져오기 선언이 '{0}'의 로컬 선언과 충돌합니다.", "Import_declarations_in_a_namespace_cannot_reference_a_module_1147": "네임스페이스의 가져오기 선언은 모듈을 참조할 수 없습니다.", "Import_emit_helpers_from_tslib_6139": "'tslib'에서 내보내기 도우미를 가져오세요.", @@ -563,8 +563,8 @@ "Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_d_2652": "병합된 선언 '{0}'에는 기본 내보내기 선언을 포함할 수 없습니다. 대신 별도의 'export default {0}' 선언을 추가하세요.", "Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constru_17013": "메타 속성 '{0}'은(는) 함수 선언, 함수 식 또는 생성기의 본문에서만 사용할 수 있습니다.", "Method_0_cannot_have_an_implementation_because_it_is_marked_abstract_1245": "'{0}' 메서드는 abstract로 표시되어 있으므로 구현이 있을 수 없습니다.", - "Method_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2_4101": "내보낸 인터페이스의 '{0}' 메서드가 전용 모듈 '{2}'의 '{1}' 이름을 가지고 있거나 사용 중입니다.", - "Method_0_of_exported_interface_has_or_is_using_private_name_1_4102": "내보낸 인터페이스의 '{0}' 메서드가 전용 이름 '{1}'을(를) 가지고 있거나 사용 중입니다.", + "Method_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2_4101": "내보낸 인터페이스의 '{0}' 메서드가 프라이빗 모듈 '{2}'의 '{1}' 이름을 가지고 있거나 사용 중입니다.", + "Method_0_of_exported_interface_has_or_is_using_private_name_1_4102": "내보낸 인터페이스의 '{0}' 메서드가 프라이빗 이름 '{1}'을(를) 가지고 있거나 사용 중입니다.", "Modifiers_cannot_appear_here_1184": "한정자를 여기에 표시할 수 없습니다.", "Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_1340": "모듈 '{0}'은(는) 형식을 참조하지 않지만, 여기에서 형식으로 사용됩니다.", "Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here_1339": "모듈 '{0}'은(는) 값을 참조하지 않지만, 여기에서 값으로 사용됩니다.", @@ -639,36 +639,36 @@ "Overload_signatures_must_all_be_ambient_or_non_ambient_2384": "오버로드 시그니처는 모두 앰비언트이거나 앰비언트가 아니어야 합니다.", "Overload_signatures_must_all_be_exported_or_non_exported_2383": "오버로드 시그니처는 모두 내보내거나 모두 내보내지 않아야 합니다.", "Overload_signatures_must_all_be_optional_or_required_2386": "오버로드 시그니처는 모두 선택 사항이거나 필수 사항이어야 합니다.", - "Overload_signatures_must_all_be_public_private_or_protected_2385": "오버로드 시그니처는 모두 공용, 전용 또는 보호된 상태여야 합니다.", + "Overload_signatures_must_all_be_public_private_or_protected_2385": "오버로드 시그니처는 모두 퍼블릭, 프라이빗 또는 보호된 상태여야 합니다.", "Parameter_0_cannot_be_referenced_in_its_initializer_2372": "매개 변수 '{0}'은(는) 해당 이니셜라이저에서 참조할 수 없습니다.", "Parameter_0_implicitly_has_an_1_type_7006": "'{0}' 매개 변수에는 암시적으로 '{1}' 형식이 포함됩니다.", "Parameter_0_is_not_in_the_same_position_as_parameter_1_1227": "'{0}' 매개 변수는 '{1}' 매개 변수와 같은 위치에 있지 않습니다.", - "Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2_4066": "내보낸 인터페이스에 있는 호출 시그니처의 '{0}' 매개 변수가 전용 모듈 '{2}'의 '{1}' 이름을 가지고 있거나 사용 중입니다.", - "Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1_4067": "내보낸 인터페이스에 있는 호출 시그니처의 '{0}' 매개 변수가 전용 이름 '{1}'을(를) 가지고 있거나 사용 중입니다.", + "Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2_4066": "내보낸 인터페이스에 있는 호출 시그니처의 '{0}' 매개 변수가 프라이빗 모듈 '{2}'의 '{1}' 이름을 가지고 있거나 사용 중입니다.", + "Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1_4067": "내보낸 인터페이스에 있는 호출 시그니처의 '{0}' 매개 변수가 프라이빗 이름 '{1}'을(를) 가지고 있거나 사용 중입니다.", "Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_can_4061": "내보낸 클래스에 있는 생성자의 '{0}' 매개 변수가 외부 모듈 {2}의 '{1}' 이름을 가지고 있거나 사용 중이지만 명명할 수 없습니다.", - "Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2_4062": "내보낸 클래스에 있는 생성자의 '{0}' 매개 변수가 전용 모듈 '{2}'의 '{1}' 이름을 가지고 있거나 사용 중입니다.", - "Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1_4063": "내보낸 클래스에 있는 생성자의 '{0}' 매개 변수가 전용 이름 '{1}'을(를) 가지고 있거나 사용 중입니다.", - "Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_mod_4064": "내보낸 인터페이스에 있는 생성자 시그니처의 '{0}' 매개 변수가 전용 모듈 '{2}'의 '{1}' 이름을 가지고 있거나 사용 중입니다.", - "Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1_4065": "내보낸 인터페이스에 있는 생성자 시그니처의 '{0}' 매개 변수가 전용 이름 '{1}'을(를) 가지고 있거나 사용 중입니다.", + "Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2_4062": "내보낸 클래스에 있는 생성자의 '{0}' 매개 변수가 프라이빗 모듈 '{2}'의 '{1}' 이름을 가지고 있거나 사용 중입니다.", + "Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1_4063": "내보낸 클래스에 있는 생성자의 '{0}' 매개 변수가 프라이빗 이름 '{1}'을(를) 가지고 있거나 사용 중입니다.", + "Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_mod_4064": "내보낸 인터페이스에 있는 생성자 시그니처의 '{0}' 매개 변수가 프라이빗 모듈 '{2}'의 '{1}' 이름을 가지고 있거나 사용 중입니다.", + "Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1_4065": "내보낸 인터페이스에 있는 생성자 시그니처의 '{0}' 매개 변수가 프라이빗 이름 '{1}'을(를) 가지고 있거나 사용 중입니다.", "Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named_4076": "내보낸 함수의 '{0}' 매개 변수가 외부 모듈 {2}의 '{1}' 이름을 가지고 있거나 사용 중이지만 명명할 수 없습니다.", - "Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2_4077": "내보낸 함수의 '{0}' 매개 변수가 전용 모듈 '{2}'의 '{1}' 이름을 가지고 있거나 사용 중입니다.", - "Parameter_0_of_exported_function_has_or_is_using_private_name_1_4078": "내보낸 함수의 '{0}' 매개 변수가 전용 이름 '{1}'을(를) 가지고 있거나 사용 중입니다.", - "Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2_4091": "내보낸 인터페이스에 있는 인덱스 시그니처의 '{0}' 매개 변수가 전용 모듈 '{2}'의 '{1}' 이름을 가지고 있거나 사용 중입니다.", - "Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1_4092": "내보낸 인터페이스에 있는 인덱스 시그니처의 '{0}' 매개 변수가 전용 이름 '{1}'을(를) 가지고 있거나 사용 중입니다.", - "Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2_4074": "내보낸 인터페이스에 있는 메서드의 '{0}' 매개 변수가 전용 모듈 '{2}'의 '{1}' 이름을 가지고 있거나 사용 중입니다.", - "Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1_4075": "내보낸 인터페이스에 있는 메서드의 '{0}' 매개 변수가 전용 이름 '{1}'을(를) 가지고 있거나 사용 중입니다.", + "Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2_4077": "내보낸 함수의 '{0}' 매개 변수가 프라이빗 모듈 '{2}'의 '{1}' 이름을 가지고 있거나 사용 중입니다.", + "Parameter_0_of_exported_function_has_or_is_using_private_name_1_4078": "내보낸 함수의 '{0}' 매개 변수가 프라이빗 이름 '{1}'을(를) 가지고 있거나 사용 중입니다.", + "Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2_4091": "내보낸 인터페이스에 있는 인덱스 시그니처의 '{0}' 매개 변수가 프라이빗 모듈 '{2}'의 '{1}' 이름을 가지고 있거나 사용 중입니다.", + "Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1_4092": "내보낸 인터페이스에 있는 인덱스 시그니처의 '{0}' 매개 변수가 프라이빗 이름 '{1}'을(를) 가지고 있거나 사용 중입니다.", + "Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2_4074": "내보낸 인터페이스에 있는 메서드의 '{0}' 매개 변수가 프라이빗 모듈 '{2}'의 '{1}' 이름을 가지고 있거나 사용 중입니다.", + "Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1_4075": "내보낸 인터페이스에 있는 메서드의 '{0}' 매개 변수가 프라이빗 이름 '{1}'을(를) 가지고 있거나 사용 중입니다.", "Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_c_4071": "내보낸 클래스에 있는 공용 메서드의 '{0}' 매개 변수가 외부 모듈 {2}의 '{1}' 이름을 가지고 있거나 사용 중이지만 명명할 수 없습니다.", - "Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2_4072": "내보낸 클래스에 있는 공용 메서드의 '{0}' 매개 변수가 전용 모듈 '{2}'의 '{1}' 이름을 가지고 있거나 사용 중입니다.", - "Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1_4073": "내보낸 클래스에 있는 공용 메서드의 '{0}' 매개 변수가 전용 이름 '{1}'을(를) 가지고 있거나 사용 중입니다.", + "Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2_4072": "내보낸 클래스에 있는 공용 메서드의 '{0}' 매개 변수가 프라이빗 모듈 '{2}'의 '{1}' 이름을 가지고 있거나 사용 중입니다.", + "Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1_4073": "내보낸 클래스에 있는 공용 메서드의 '{0}' 매개 변수가 프라이빗 이름 '{1}'을(를) 가지고 있거나 사용 중입니다.", "Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module__4068": "내보낸 클래스에 있는 공용 정적 메서드의 '{0}' 매개 변수가 외부 모듈 {2}의 '{1}' 이름을 가지고 있거나 사용 중이지만 명명할 수 없습니다.", - "Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2_4069": "내보낸 클래스에 있는 공용 정적 메서드의 '{0}' 매개 변수가 전용 모듈 '{2}'의 '{1}' 이름을 가지고 있거나 사용 중입니다.", - "Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1_4070": "내보낸 클래스에 있는 공용 정적 메서드의 '{0}' 매개 변수가 전용 이름 '{1}'을(를) 가지고 있거나 사용 중입니다.", + "Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2_4069": "내보낸 클래스에 있는 공용 정적 메서드의 '{0}' 매개 변수가 프라이빗 모듈 '{2}'의 '{1}' 이름을 가지고 있거나 사용 중입니다.", + "Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1_4070": "내보낸 클래스에 있는 공용 정적 메서드의 '{0}' 매개 변수가 프라이빗 이름 '{1}'을(를) 가지고 있거나 사용 중입니다.", "Parameter_cannot_have_question_mark_and_initializer_1015": "매개 변수에 물음표와 이니셜라이저를 사용할 수 없습니다.", "Parameter_declaration_expected_1138": "매개 변수 선언이 필요합니다.", - "Parameter_type_of_public_setter_0_from_exported_class_has_or_is_using_name_1_from_private_module_2_4036": "내보낸 클래스에 있는 공용 setter '{0}'의 매개 변수 형식이 전용 모듈 '{2}'의 이름 '{1}'을(를) 가지고 있거나 사용 중입니다.", - "Parameter_type_of_public_setter_0_from_exported_class_has_or_is_using_private_name_1_4037": "내보낸 클래스에 있는 공용 setter '{0}'의 매개 변수 형식이 전용 이름 '{1}'을(를) 가지고 있거나 사용 중입니다.", - "Parameter_type_of_public_static_setter_0_from_exported_class_has_or_is_using_name_1_from_private_mod_4034": "내보낸 클래스에 있는 공용 정적 setter '{0}'의 매개 변수 형식이 전용 모듈 '{2}'의 이름 '{1}'을(를) 가지고 있거나 사용 중입니다.", - "Parameter_type_of_public_static_setter_0_from_exported_class_has_or_is_using_private_name_1_4035": "내보낸 클래스에 있는 공용 정적 setter '{0}'의 매개 변수 형식이 전용 이름 '{1}'을(를) 가지고 있거나 사용 중입니다.", + "Parameter_type_of_public_setter_0_from_exported_class_has_or_is_using_name_1_from_private_module_2_4036": "내보낸 클래스에 있는 공용 setter '{0}'의 매개 변수 형식이 프라이빗 모듈 '{2}'의 이름 '{1}'을(를) 가지고 있거나 사용 중입니다.", + "Parameter_type_of_public_setter_0_from_exported_class_has_or_is_using_private_name_1_4037": "내보낸 클래스에 있는 공용 setter '{0}'의 매개 변수 형식이 프라이빗 이름 '{1}'을(를) 가지고 있거나 사용 중입니다.", + "Parameter_type_of_public_static_setter_0_from_exported_class_has_or_is_using_name_1_from_private_mod_4034": "내보낸 클래스에 있는 공용 정적 setter '{0}'의 매개 변수 형식이 프라이빗 모듈 '{2}'의 이름 '{1}'을(를) 가지고 있거나 사용 중입니다.", + "Parameter_type_of_public_static_setter_0_from_exported_class_has_or_is_using_private_name_1_4035": "내보낸 클래스에 있는 공용 정적 setter '{0}'의 매개 변수 형식이 프라이빗 이름 '{1}'을(를) 가지고 있거나 사용 중입니다.", "Parse_in_strict_mode_and_emit_use_strict_for_each_source_file_6141": "strict 모드에서 구문 분석하고 각 소스 파일에 대해 \"use strict\"를 내보냅니다.", "Pattern_0_can_have_at_most_one_Asterisk_character_5061": "'{0}' 패턴에는 '*' 문자를 최대 하나만 사용할 수 있습니다.", "Prefix_0_with_an_underscore_90025": "'{0}' 앞에 밑줄 추가", @@ -709,9 +709,9 @@ "Property_0_is_protected_in_type_1_but_public_in_type_2_2444": "'{0}' 속성은 '{1}' 형식에서는 보호된 속성이지만 '{2}' 형식에서는 공용입니다.", "Property_0_is_used_before_being_assigned_2565": "'{0}' 속성이 할당되기 전에 사용되었습니다.", "Property_0_of_JSX_spread_attribute_is_not_assignable_to_target_property_2606": "JSX 분배 특성의 '{0}' 속성을 대상 속성에 할당할 수 없습니다.", - "Property_0_of_exported_class_expression_may_not_be_private_or_protected_4094": "내보낸 클래스 식의 속성 '{0}'이(가) 비공개가 아니거나 보호되지 않을 수 있습니다.", - "Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2_4032": "내보낸 인터페이스의 '{0}' 속성이 전용 모듈 '{2}'의 '{1}' 이름을 가지고 있거나 사용 중입니다.", - "Property_0_of_exported_interface_has_or_is_using_private_name_1_4033": "내보낸 인터페이스의 '{0}' 속성이 전용 이름 '{1}'을(를) 가지고 있거나 사용 중입니다.", + "Property_0_of_exported_class_expression_may_not_be_private_or_protected_4094": "내보낸 클래스 식의 속성 '{0}'이(가) 프라이빗이 아니거나 보호되지 않을 수 있습니다.", + "Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2_4032": "내보낸 인터페이스의 '{0}' 속성이 프라이빗 모듈 '{2}'의 '{1}' 이름을 가지고 있거나 사용 중입니다.", + "Property_0_of_exported_interface_has_or_is_using_private_name_1_4033": "내보낸 인터페이스의 '{0}' 속성이 프라이빗 이름 '{1}'을(를) 가지고 있거나 사용 중입니다.", "Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2_2412": "'{1}' 형식의 '{0}' 속성을 숫자 인덱스 형식 '{2}'에 할당할 수 없습니다.", "Property_0_of_type_1_is_not_assignable_to_string_index_type_2_2411": "'{1}' 형식의 '{0}' 속성을 문자열 인덱스 형식 '{2}'에 할당할 수 없습니다.", "Property_assignment_expected_1136": "속성 할당이 필요합니다.", @@ -720,17 +720,17 @@ "Property_value_can_only_be_string_literal_numeric_literal_true_false_null_object_literal_or_array_li_1328": "속성 값은 문자열 리터럴, 숫자 리터럴, 'true', 'false', 'null', 개체 리터럴 또는 배열 리터럴이어야 합니다.", "Provide_full_support_for_iterables_in_for_of_spread_and_destructuring_when_targeting_ES5_or_ES3_6179": "'ES5' 또는 'ES3'을 대상으로 할 경우 'for-of', spread 및 소멸의 반복 가능한 개체를 완벽히 지원합니다.", "Public_method_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named_4098": "내보낸 클래스의 공용 메서드 '{0}'이(가) 외부 모듈 {2}의 '{1}' 이름을 가지고 있거나 사용 중이지만 명명할 수 없습니다.", - "Public_method_0_of_exported_class_has_or_is_using_name_1_from_private_module_2_4099": "내보낸 클래스의 공용 메서드 '{0}'이(가) 전용 모듈 '{2}'의 '{1}' 이름을 가지고 있거나 사용 중입니다.", - "Public_method_0_of_exported_class_has_or_is_using_private_name_1_4100": "내보낸 클래스의 공용 메서드의 '{0}'이(가) 전용 이름 '{1}'을(를) 가지고 있거나 사용 중입니다.", + "Public_method_0_of_exported_class_has_or_is_using_name_1_from_private_module_2_4099": "내보낸 클래스의 공용 메서드 '{0}'이(가) 프라이빗 모듈 '{2}'의 '{1}' 이름을 가지고 있거나 사용 중입니다.", + "Public_method_0_of_exported_class_has_or_is_using_private_name_1_4100": "내보낸 클래스의 공용 메서드의 '{0}'이(가) 프라이빗 이름 '{1}'을(를) 가지고 있거나 사용 중입니다.", "Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_name_4029": "내보낸 클래스의 공용 속성 '{0}'이(가) 외부 모듈 {2}의 '{1}' 이름을 가지고 있거나 사용 중이지만 명명할 수 없습니다.", - "Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2_4030": "내보낸 클래스의 공용 속성 '{0}'이(가) 전용 모듈 '{2}'의 '{1}' 이름을 가지고 있거나 사용 중입니다.", - "Public_property_0_of_exported_class_has_or_is_using_private_name_1_4031": "내보낸 클래스의 공용 속성 '{0}'이(가) 전용 이름 '{1}'을(를) 가지고 있거나 사용 중입니다.", + "Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2_4030": "내보낸 클래스의 공용 속성 '{0}'이(가) 프라이빗 모듈 '{2}'의 '{1}' 이름을 가지고 있거나 사용 중입니다.", + "Public_property_0_of_exported_class_has_or_is_using_private_name_1_4031": "내보낸 클래스의 공용 속성 '{0}'이(가) 프라이빗 이름 '{1}'을(를) 가지고 있거나 사용 중입니다.", "Public_static_method_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_4095": "내보낸 클래스의 공용 정적 메서드 '{0}'이(가) 외부 모듈 {2}의 '{1}' 이름을 가지고 있거나 사용 중이지만 명명할 수 없습니다.", - "Public_static_method_0_of_exported_class_has_or_is_using_name_1_from_private_module_2_4096": "내보낸 클래스에 있는 공용 정적 메서드 '{0}'이(가) 전용 모듈 '{2}'의 '{1}' 이름을 가지고 있거나 사용 중입니다.", - "Public_static_method_0_of_exported_class_has_or_is_using_private_name_1_4097": "내보낸 클래스의 공용 정적 메서드 '{0}'이(가) 전용 이름 '{1}'을(를) 가지고 있거나 사용 중입니다.", + "Public_static_method_0_of_exported_class_has_or_is_using_name_1_from_private_module_2_4096": "내보낸 클래스에 있는 공용 정적 메서드 '{0}'이(가) 프라이빗 모듈 '{2}'의 '{1}' 이름을 가지고 있거나 사용 중입니다.", + "Public_static_method_0_of_exported_class_has_or_is_using_private_name_1_4097": "내보낸 클래스의 공용 정적 메서드 '{0}'이(가) 프라이빗 이름 '{1}'을(를) 가지고 있거나 사용 중입니다.", "Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot__4026": "내보낸 클래스에 있는 공용 정적 속성 '{0}'이(가) 외부 모듈 {2}의 '{1}' 이름을 가지고 있거나 사용 중이지만 명명할 수 없습니다.", - "Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2_4027": "내보낸 클래스의 공용 정적 속성 '{0}'이(가) 전용 모듈 '{2}'의 '{1}' 이름을 가지고 있거나 사용 중입니다.", - "Public_static_property_0_of_exported_class_has_or_is_using_private_name_1_4028": "내보낸 클래스의 공용 정적 속성 '{0}'이(가) 전용 이름 '{1}'을(를) 가지고 있거나 사용 중입니다.", + "Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2_4027": "내보낸 클래스의 공용 정적 속성 '{0}'이(가) 프라이빗 모듈 '{2}'의 '{1}' 이름을 가지고 있거나 사용 중입니다.", + "Public_static_property_0_of_exported_class_has_or_is_using_private_name_1_4028": "내보낸 클래스의 공용 정적 속성 '{0}'이(가) 프라이빗 이름 '{1}'을(를) 가지고 있거나 사용 중입니다.", "Raise_error_on_expressions_and_declarations_with_an_implied_any_type_6052": "암시된 'any' 형식이 있는 식 및 선언에서 오류를 발생합니다.", "Raise_error_on_this_expressions_with_an_implied_any_type_6115": "암시된 'any' 형식이 있는 'this' 식에서 오류를 발생합니다.", "Redirect_output_structure_to_the_directory_6006": "출력 구조를 디렉터리로 리디렉션합니다.", @@ -765,30 +765,30 @@ "Resolving_with_primary_search_path_0_6121": "기본 검색 경로 '{0}'을(를) 사용하여 확인하는 중입니다.", "Rest_parameter_0_implicitly_has_an_any_type_7019": "Rest 매개 변수 '{0}'에는 암시적으로 'any[]' 형식이 포함됩니다.", "Rest_types_may_only_be_created_from_object_types_2700": "rest 유형은 개체 형식에서만 만들 수 있습니다.", - "Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1_4046": "내보낸 인터페이스에 있는 호출 시그니처의 반환 형식이 전용 모듈 '{1}'의 '{0}' 이름을 가지고 있거나 사용 중입니다.", - "Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0_4047": "내보낸 인터페이스에 있는 호출 시그니처의 반환 형식이 전용 이름 '{0}'을(를) 가지고 있거나 사용 중입니다.", - "Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_mod_4044": "내보낸 인터페이스에 있는 생성자 시그니처의 반환 형식이 전용 모듈 '{1}'의 '{0}' 이름을 가지고 있거나 사용 중입니다.", - "Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0_4045": "내보낸 인터페이스에 있는 생성자 시그니처의 반환 형식이 전용 이름 '{0}'을(를) 가지고 있거나 사용 중입니다.", + "Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1_4046": "내보낸 인터페이스에 있는 호출 시그니처의 반환 형식이 프라이빗 모듈 '{1}'의 '{0}' 이름을 가지고 있거나 사용 중입니다.", + "Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0_4047": "내보낸 인터페이스에 있는 호출 시그니처의 반환 형식이 프라이빗 이름 '{0}'을(를) 가지고 있거나 사용 중입니다.", + "Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_mod_4044": "내보낸 인터페이스에 있는 생성자 시그니처의 반환 형식이 프라이빗 모듈 '{1}'의 '{0}' 이름을 가지고 있거나 사용 중입니다.", + "Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0_4045": "내보낸 인터페이스에 있는 생성자 시그니처의 반환 형식이 프라이빗 이름 '{0}'을(를) 가지고 있거나 사용 중입니다.", "Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class_2409": "생성자 시그니처의 반환 형식을 클래스의 인스턴스 형식에 할당할 수 있어야 합니다.", "Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named_4058": "내보낸 함수의 반환 형식이 외부 모듈 {1}의 '{0}' 이름을 가지고 있거나 사용 중이지만 명명할 수 없습니다.", - "Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1_4059": "내보낸 함수의 반환 형식이 전용 모듈 '{1}'의 '{0}' 이름을 가지고 있거나 사용 중입니다.", - "Return_type_of_exported_function_has_or_is_using_private_name_0_4060": "내보낸 함수의 반환 형식이 전용 이름 '{0}'을(를) 가지고 있거나 사용 중입니다.", - "Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1_4048": "내보낸 인터페이스에 있는 인덱스 시그니처의 반환 형식이 전용 모듈 '{1}'의 '{0}' 이름을 가지고 있거나 사용 중입니다.", - "Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0_4049": "내보낸 인터페이스에 있는 인덱스 시그니처의 반환 형식이 전용 이름 '{0}'을(를) 가지고 있거나 사용 중입니다.", - "Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1_4056": "내보낸 인터페이스에 있는 메서드의 반환 형식이 전용 모듈 '{1}'의 '{0}' 이름을 가지고 있거나 사용 중입니다.", - "Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0_4057": "내보낸 인터페이스에 있는 메서드의 반환 형식이 전용 이름 '{0}'을(를) 가지고 있거나 사용 중입니다.", + "Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1_4059": "내보낸 함수의 반환 형식이 프라이빗 모듈 '{1}'의 '{0}' 이름을 가지고 있거나 사용 중입니다.", + "Return_type_of_exported_function_has_or_is_using_private_name_0_4060": "내보낸 함수의 반환 형식이 프라이빗 이름 '{0}'을(를) 가지고 있거나 사용 중입니다.", + "Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1_4048": "내보낸 인터페이스에 있는 인덱스 시그니처의 반환 형식이 프라이빗 모듈 '{1}'의 '{0}' 이름을 가지고 있거나 사용 중입니다.", + "Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0_4049": "내보낸 인터페이스에 있는 인덱스 시그니처의 반환 형식이 프라이빗 이름 '{0}'을(를) 가지고 있거나 사용 중입니다.", + "Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1_4056": "내보낸 인터페이스에 있는 메서드의 반환 형식이 프라이빗 모듈 '{1}'의 '{0}' 이름을 가지고 있거나 사용 중입니다.", + "Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0_4057": "내보낸 인터페이스에 있는 메서드의 반환 형식이 프라이빗 이름 '{0}'을(를) 가지고 있거나 사용 중입니다.", "Return_type_of_public_getter_0_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_4041": "내보낸 클래스에 있는 공용 getter '{0}'의 반환 형식이 외부 모듈 {2}의 이름 '{1}'을(를) 가지고 있거나 사용 중이지만 명명할 수 없습니다.", - "Return_type_of_public_getter_0_from_exported_class_has_or_is_using_name_1_from_private_module_2_4042": "내보낸 클래스에 있는 공용 getter '{0}'의 반환 형식이 전용 모듈 '{2}'의 이름 '{1}'을(를) 가지고 있거나 사용 중입니다.", - "Return_type_of_public_getter_0_from_exported_class_has_or_is_using_private_name_1_4043": "내보낸 클래스에 있는 공용 getter '{0}'의 반환 형식이 전용 이름 '{1}'을(를) 가지고 있거나 사용 중입니다.", + "Return_type_of_public_getter_0_from_exported_class_has_or_is_using_name_1_from_private_module_2_4042": "내보낸 클래스에 있는 공용 getter '{0}'의 반환 형식이 프라이빗 모듈 '{2}'의 이름 '{1}'을(를) 가지고 있거나 사용 중입니다.", + "Return_type_of_public_getter_0_from_exported_class_has_or_is_using_private_name_1_4043": "내보낸 클래스에 있는 공용 getter '{0}'의 반환 형식이 프라이빗 이름 '{1}'을(를) 가지고 있거나 사용 중입니다.", "Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_c_4053": "내보낸 클래스에 있는 공용 메서드의 반환 형식이 외부 모듈 {1}의 '{0}' 이름을 가지고 있거나 사용 중이지만 명명할 수 없습니다.", - "Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1_4054": "내보낸 클래스에 있는 공용 메서드의 반환 형식이 전용 모듈 '{1}'의 '{0}' 이름을 가지고 있거나 사용 중입니다.", - "Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0_4055": "내보낸 클래스에 있는 공용 메서드의 반환 형식이 전용 이름 '{0}'을(를) 가지고 있거나 사용 중입니다.", + "Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1_4054": "내보낸 클래스에 있는 공용 메서드의 반환 형식이 프라이빗 모듈 '{1}'의 '{0}' 이름을 가지고 있거나 사용 중입니다.", + "Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0_4055": "내보낸 클래스에 있는 공용 메서드의 반환 형식이 프라이빗 이름 '{0}'을(를) 가지고 있거나 사용 중입니다.", "Return_type_of_public_static_getter_0_from_exported_class_has_or_is_using_name_1_from_external_modul_4038": "내보낸 클래스에 있는 공용 정적 getter '{0}'의 반환 형식이 외부 모듈 {2}의 이름 '{1}'을(를) 가지고 있거나 사용 중이지만 명명할 수 없습니다.", - "Return_type_of_public_static_getter_0_from_exported_class_has_or_is_using_name_1_from_private_module_4039": "내보낸 클래스에 있는 공용 정적 getter '{0}'의 반환 형식이 전용 모듈 '{2}'의 이름 '{1}'을(를) 가지고 있거나 사용 중입니다.", - "Return_type_of_public_static_getter_0_from_exported_class_has_or_is_using_private_name_1_4040": "내보낸 클래스에 있는 공용 정적 getter '{0}'의 반환 형식이 전용 이름 '{1}'을(를) 가지고 있거나 사용 중입니다.", + "Return_type_of_public_static_getter_0_from_exported_class_has_or_is_using_name_1_from_private_module_4039": "내보낸 클래스에 있는 공용 정적 getter '{0}'의 반환 형식이 프라이빗 모듈 '{2}'의 이름 '{1}'을(를) 가지고 있거나 사용 중입니다.", + "Return_type_of_public_static_getter_0_from_exported_class_has_or_is_using_private_name_1_4040": "내보낸 클래스에 있는 공용 정적 getter '{0}'의 반환 형식이 프라이빗 이름 '{1}'을(를) 가지고 있거나 사용 중입니다.", "Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module__4050": "내보낸 클래스에 있는 공용 정적 메서드의 반환 형식이 외부 모듈 {1}의 '{0}' 이름을 가지고 있거나 사용 중이지만 명명할 수 없습니다.", - "Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1_4051": "내보낸 클래스에 있는 공용 정적 메서드의 반환 형식이 전용 모듈 '{1}'의 '{0}' 이름을 가지고 있거나 사용 중입니다.", - "Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0_4052": "내보낸 클래스에 있는 공용 정적 메서드의 반환 형식이 전용 이름 '{0}'을(를) 가지고 있거나 사용 중입니다.", + "Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1_4051": "내보낸 클래스에 있는 공용 정적 메서드의 반환 형식이 프라이빗 모듈 '{1}'의 '{0}' 이름을 가지고 있거나 사용 중입니다.", + "Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0_4052": "내보낸 클래스에 있는 공용 정적 메서드의 반환 형식이 프라이빗 이름 '{0}'을(를) 가지고 있거나 사용 중입니다.", "Reusing_module_resolutions_originating_in_0_since_resolutions_are_unchanged_from_old_program_6184": "이전 프로그램에서 변경되지 않았으므로 '{0}'에서 발생하는 모듈 확인을 다시 사용합니다.", "Reusing_resolution_of_module_0_to_file_1_from_old_program_6183": "'{0}' 모듈 확인을 이전 프로그램의 '{1}' 파일에 다시 사용합니다.", "Rewrite_all_as_indexed_access_types_95034": "인덱싱된 액세스 형식으로 모두 다시 작성", @@ -939,15 +939,15 @@ "Type_of_yield_operand_in_an_async_generator_must_either_be_a_valid_promise_or_must_not_contain_a_cal_1321": "비동기 생성기에 있는 'yield' 형식의 피연산자는 유효한 프라미스여야 하거나 호출 가능 'then' 멤버를 포함하지 않아야 합니다.", "Type_parameter_0_has_a_circular_constraint_2313": "형식 매개 변수 '{0}'에 순환 제약 조건이 있습니다.", "Type_parameter_0_has_a_circular_default_2716": "형식 매개 변수 '{0}'에 순환 기본값이 있습니다.", - "Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1_4008": "내보낸 인터페이스에 있는 호출 시그니처의 형식 매개 변수 '{0}'이(가) 전용 이름 '{1}'을(를) 가지고 있거나 사용 중입니다.", - "Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1_4006": "내보낸 인터페이스에 있는 생성자 시그니처의 형식 매개 변수 '{0}'이(가) 전용 이름 '{1}'을(를) 가지고 있거나 사용 중입니다.", - "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002": "내보낸 클래스의 형식 매개 변수 '{0}'이(가) 전용 이름 '{1}'을(를) 가지고 있거나 사용 중입니다.", - "Type_parameter_0_of_exported_function_has_or_is_using_private_name_1_4016": "내보낸 함수의 형식 매개 변수 '{0}'이(가) 전용 이름 '{1}'을(를) 가지고 있거나 사용 중입니다.", - "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004": "내보낸 인터페이스의 형식 매개 변수 '{0}'이(가) 전용 이름 '{1}'을(를) 가지고 있거나 사용 중입니다.", - "Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1_4083": "내보낸 형식 별칭의 형식 매개 변수 '{0}'이(가) 전용 이름 '{1}'을(를) 가지고 있거나 사용 중입니다.", - "Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1_4014": "내보낸 인터페이스에 있는 메서드의 형식 매개 변수 '{0}'이(가) 전용 이름 '{1}'을(를) 가지고 있거나 사용 중입니다.", - "Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1_4012": "내보낸 클래스에 있는 공용 메서드의 형식 매개 변수 '{0}'이(가) 전용 이름 '{1}'을(를) 가지고 있거나 사용 중입니다.", - "Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1_4010": "내보낸 클래스에 있는 공용 정적 메서드의 형식 매개 변수 '{0}'이(가) 전용 이름 '{1}'을(를) 가지고 있거나 사용 중입니다.", + "Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1_4008": "내보낸 인터페이스에 있는 호출 시그니처의 형식 매개 변수 '{0}'이(가) 프라이빗 이름 '{1}'을(를) 가지고 있거나 사용 중입니다.", + "Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1_4006": "내보낸 인터페이스에 있는 생성자 시그니처의 형식 매개 변수 '{0}'이(가) 프라이빗 이름 '{1}'을(를) 가지고 있거나 사용 중입니다.", + "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002": "내보낸 클래스의 형식 매개 변수 '{0}'이(가) 프라이빗 이름 '{1}'을(를) 가지고 있거나 사용 중입니다.", + "Type_parameter_0_of_exported_function_has_or_is_using_private_name_1_4016": "내보낸 함수의 형식 매개 변수 '{0}'이(가) 프라이빗 이름 '{1}'을(를) 가지고 있거나 사용 중입니다.", + "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004": "내보낸 인터페이스의 형식 매개 변수 '{0}'이(가) 프라이빗 이름 '{1}'을(를) 가지고 있거나 사용 중입니다.", + "Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1_4083": "내보낸 형식 별칭의 형식 매개 변수 '{0}'이(가) 프라이빗 이름 '{1}'을(를) 가지고 있거나 사용 중입니다.", + "Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1_4014": "내보낸 인터페이스에 있는 메서드의 형식 매개 변수 '{0}'이(가) 프라이빗 이름 '{1}'을(를) 가지고 있거나 사용 중입니다.", + "Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1_4012": "내보낸 클래스에 있는 공용 메서드의 형식 매개 변수 '{0}'이(가) 프라이빗 이름 '{1}'을(를) 가지고 있거나 사용 중입니다.", + "Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1_4010": "내보낸 클래스에 있는 공용 정적 메서드의 형식 매개 변수 '{0}'이(가) 프라이빗 이름 '{1}'을(를) 가지고 있거나 사용 중입니다.", "Type_parameter_declaration_expected_1139": "형식 매개 변수 선언이 필요합니다.", "Type_parameter_list_cannot_be_empty_1098": "형식 매개 변수 목록은 비워 둘 수 없습니다.", "Type_parameter_name_cannot_be_0_2368": "형식 매개 변수 이름은 '{0}'일 수 없습니다.", @@ -955,7 +955,7 @@ "Type_predicate_0_is_not_assignable_to_1_1226": "형식 조건자 '{0}'을(를) '{1}'에 할당할 수 없습니다.", "Type_reference_directive_0_was_not_resolved_6120": "======== 형식 참조 지시문 '{0}'이(가) 확인되지 않았습니다. ========", "Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2_6119": "======== 형식 참조 지시문 '{0}'이(가) '{1}'(으)로 확인되었습니다. 주: {2}. ========", - "Types_have_separate_declarations_of_a_private_property_0_2442": "형식에 별도의 전용 속성 '{0}' 선언이 있습니다.", + "Types_have_separate_declarations_of_a_private_property_0_2442": "형식에 별도의 프라이빗 속성 '{0}' 선언이 있습니다.", "Types_of_parameters_0_and_1_are_incompatible_2328": "'{0}' 및 '{1}' 매개 변수의 형식이 호환되지 않습니다.", "Types_of_property_0_are_incompatible_2326": "'{0}' 속성의 형식이 호환되지 않습니다.", "Unable_to_open_file_0_6050": "'{0}' 파일을 열 수 없습니다.", @@ -1047,8 +1047,8 @@ "export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always__2668": "앰비언트 모듈 및 모듈 확대는 항상 표시되므로 'export' 한정자를 적용할 수 없습니다.", "extends_clause_already_seen_1172": "'extends' 절이 이미 있습니다.", "extends_clause_must_precede_implements_clause_1173": "'extends' 절은 'implements' 절 앞에 와야 합니다.", - "extends_clause_of_exported_class_0_has_or_is_using_private_name_1_4020": "내보낸 클래스 '{0}'의 Extends 절이 전용 이름 '{1}'을(를) 가지고 있거나 사용 중입니다.", - "extends_clause_of_exported_interface_0_has_or_is_using_private_name_1_4022": "내보낸 인터페이스 '{0}'의 Extends 절이 전용 이름 '{1}'을(를) 가지고 있거나 사용 중입니다.", + "extends_clause_of_exported_class_0_has_or_is_using_private_name_1_4020": "내보낸 클래스 '{0}'의 Extends 절이 프라이빗 이름 '{1}'을(를) 가지고 있거나 사용 중입니다.", + "extends_clause_of_exported_interface_0_has_or_is_using_private_name_1_4022": "내보낸 인터페이스 '{0}'의 Extends 절이 프라이빗 이름 '{1}'을(를) 가지고 있거나 사용 중입니다.", "file_6025": "파일", "get_and_set_accessor_must_have_the_same_this_type_2682": "'get' 및 'set' 접근자는 동일한 'this' 형식이어야 합니다.", "get_and_set_accessor_must_have_the_same_type_2380": "'get' 및 'set' 접근자의 형식이 같아야 합니다.", diff --git a/lib/lib.dom.d.ts b/lib/lib.dom.d.ts index 7817a0e4267..92500ffc046 100644 --- a/lib/lib.dom.d.ts +++ b/lib/lib.dom.d.ts @@ -153,6 +153,34 @@ interface AudioWorkletNodeOptions extends AudioNodeOptions { processorOptions?: any; } +interface AuthenticationExtensionsClientInputs { + appid?: string; + authnSel?: AuthenticatorSelectionList; + exts?: boolean; + loc?: boolean; + txAuthGeneric?: txAuthGenericArg; + txAuthSimple?: string; + uvi?: boolean; + uvm?: boolean; +} + +interface AuthenticationExtensionsClientOutputs { + appid?: boolean; + authnSel?: boolean; + exts?: AuthenticationExtensionsSupported; + loc?: Coordinates; + txAuthGeneric?: ArrayBuffer; + txAuthSimple?: string; + uvi?: ArrayBuffer; + uvm?: UvmEntries; +} + +interface AuthenticatorSelectionCriteria { + authenticatorAttachment?: AuthenticatorAttachment; + requireResidentKey?: boolean; + userVerification?: UserVerificationRequirement; +} + interface BiquadFilterOptions extends AudioNodeOptions { Q?: number; detune?: number; @@ -171,7 +199,6 @@ interface ByteLengthChunk { } interface CacheQueryOptions { - cacheName?: string; ignoreMethod?: boolean; ignoreSearch?: boolean; ignoreVary?: boolean; @@ -179,6 +206,7 @@ interface CacheQueryOptions { interface CanvasRenderingContext2DSettings { alpha?: boolean; + desynchronized?: boolean; } interface ChannelMergerOptions extends AudioNodeOptions { @@ -256,7 +284,7 @@ interface ConstrainDoubleRange extends DoubleRange { ideal?: number; } -interface ConstrainLongRange extends LongRange { +interface ConstrainULongRange extends ULongRange { exact?: number; ideal?: number; } @@ -271,6 +299,17 @@ interface ConvolverOptions extends AudioNodeOptions { disableNormalization?: boolean; } +interface CredentialCreationOptions { + publicKey?: PublicKeyCredentialCreationOptions; + signal?: AbortSignal; +} + +interface CredentialRequestOptions { + mediation?: CredentialMediationRequirement; + publicKey?: PublicKeyCredentialRequestOptions; + signal?: AbortSignal; +} + interface CustomEventInit extends EventInit { detail?: T; } @@ -330,21 +369,27 @@ interface DelayOptions extends AudioNodeOptions { maxDelayTime?: number; } -interface DeviceAccelerationDict { +interface DeviceLightEventInit extends EventInit { + value?: number; +} + +interface DeviceMotionEventAccelerationInit { x?: number | null; y?: number | null; z?: number | null; } -interface DeviceLightEventInit extends EventInit { - value?: number; +interface DeviceMotionEventInit extends EventInit { + acceleration?: DeviceMotionEventAccelerationInit; + accelerationIncludingGravity?: DeviceMotionEventAccelerationInit; + interval?: number; + rotationRate?: DeviceMotionEventRotationRateInit; } -interface DeviceMotionEventInit extends EventInit { - acceleration?: DeviceAccelerationDict | null; - accelerationIncludingGravity?: DeviceAccelerationDict | null; - interval?: number | null; - rotationRate?: DeviceRotationRateDict | null; +interface DeviceMotionEventRotationRateInit { + alpha?: number | null; + beta?: number | null; + gamma?: number | null; } interface DeviceOrientationEventInit extends EventInit { @@ -354,10 +399,9 @@ interface DeviceOrientationEventInit extends EventInit { gamma?: number | null; } -interface DeviceRotationRateDict { - alpha?: number | null; - beta?: number | null; - gamma?: number | null; +interface DevicePermissionDescriptor extends PermissionDescriptor { + deviceId?: string; + name: "camera" | "microphone" | "speaker"; } interface DocumentTimelineOptions { @@ -412,6 +456,10 @@ interface EffectTiming { iterations?: number; } +interface ElementCreationOptions { + is?: string; +} + interface ElementDefinitionOptions { extends?: string; } @@ -444,7 +492,6 @@ interface EventModifierInit extends UIEventInit { modifierFnLock?: boolean; modifierHyper?: boolean; modifierNumLock?: boolean; - modifierOS?: boolean; modifierScrollLock?: boolean; modifierSuper?: boolean; modifierSymbol?: boolean; @@ -553,11 +600,27 @@ interface IIRFilterOptions extends AudioNodeOptions { feedforward: number[]; } +interface ImageBitmapRenderingContextSettings { + alpha?: boolean; +} + +interface ImageEncodeOptions { + quality?: number; + type?: string; +} + +interface InputEventInit extends UIEventInit { + data?: string | null; + inputType?: string; + isComposing?: boolean; +} + interface IntersectionObserverEntryInit { boundingClientRect: DOMRectInit; + intersectionRatio: number; intersectionRect: DOMRectInit; isIntersecting: boolean; - rootBounds: DOMRectInit; + rootBounds: DOMRectInit | null; target: Element; time: number; } @@ -595,6 +658,7 @@ interface KeyAlgorithm { interface KeyboardEventInit extends EventModifierInit { code?: string; + isComposing?: boolean; key?: string; location?: number; repeat?: boolean; @@ -616,11 +680,6 @@ interface KeyframeEffectOptions extends EffectTiming { iterationComposite?: IterationCompositeOperation; } -interface LongRange { - max?: number; - min?: number; -} - interface MediaElementAudioSourceOptions { mediaElement: HTMLMediaElement; } @@ -678,39 +737,43 @@ interface MediaStreamTrackAudioSourceOptions { } interface MediaStreamTrackEventInit extends EventInit { - track?: MediaStreamTrack | null; + track: MediaStreamTrack; } interface MediaTrackCapabilities { - aspectRatio?: number | DoubleRange; + aspectRatio?: DoubleRange; + autoGainControl?: boolean[]; + channelCount?: ULongRange; deviceId?: string; echoCancellation?: boolean[]; - facingMode?: string; - frameRate?: number | DoubleRange; + facingMode?: string[]; + frameRate?: DoubleRange; groupId?: string; - height?: number | LongRange; - sampleRate?: number | LongRange; - sampleSize?: number | LongRange; - volume?: number | DoubleRange; - width?: number | LongRange; + height?: ULongRange; + latency?: DoubleRange; + noiseSuppression?: boolean[]; + resizeMode?: string[]; + sampleRate?: ULongRange; + sampleSize?: ULongRange; + width?: ULongRange; } interface MediaTrackConstraintSet { - aspectRatio?: number | ConstrainDoubleRange; - channelCount?: number | ConstrainLongRange; - deviceId?: string | string[] | ConstrainDOMStringParameters; - displaySurface?: string | string[] | ConstrainDOMStringParameters; - echoCancellation?: boolean | ConstrainBooleanParameters; - facingMode?: string | string[] | ConstrainDOMStringParameters; - frameRate?: number | ConstrainDoubleRange; - groupId?: string | string[] | ConstrainDOMStringParameters; - height?: number | ConstrainLongRange; - latency?: number | ConstrainDoubleRange; - logicalSurface?: boolean | ConstrainBooleanParameters; - sampleRate?: number | ConstrainLongRange; - sampleSize?: number | ConstrainLongRange; - volume?: number | ConstrainDoubleRange; - width?: number | ConstrainLongRange; + aspectRatio?: ConstrainDouble; + autoGainControl?: ConstrainBoolean; + channelCount?: ConstrainULong; + deviceId?: ConstrainDOMString; + echoCancellation?: ConstrainBoolean; + facingMode?: ConstrainDOMString; + frameRate?: ConstrainDouble; + groupId?: ConstrainDOMString; + height?: ConstrainULong; + latency?: ConstrainDouble; + noiseSuppression?: ConstrainBoolean; + resizeMode?: ConstrainDOMString; + sampleRate?: ConstrainULong; + sampleSize?: ConstrainULong; + width?: ConstrainULong; } interface MediaTrackConstraints extends MediaTrackConstraintSet { @@ -719,29 +782,37 @@ interface MediaTrackConstraints extends MediaTrackConstraintSet { interface MediaTrackSettings { aspectRatio?: number; + autoGainControl?: boolean; + channelCount?: number; deviceId?: string; echoCancellation?: boolean; facingMode?: string; frameRate?: number; groupId?: string; height?: number; + latency?: number; + noiseSuppression?: boolean; + resizeMode?: string; sampleRate?: number; sampleSize?: number; - volume?: number; width?: number; } interface MediaTrackSupportedConstraints { aspectRatio?: boolean; + autoGainControl?: boolean; + channelCount?: boolean; deviceId?: boolean; echoCancellation?: boolean; facingMode?: boolean; frameRate?: boolean; groupId?: boolean; height?: boolean; + latency?: boolean; + noiseSuppression?: boolean; + resizeMode?: boolean; sampleRate?: boolean; sampleSize?: boolean; - volume?: boolean; width?: boolean; } @@ -753,6 +824,11 @@ interface MessageEventInit extends EventInit { source?: MessageEventSource | null; } +interface MidiPermissionDescriptor extends PermissionDescriptor { + name: "midi"; + sysex?: boolean; +} + interface MouseEventInit extends EventModifierInit { button?: number; buttons?: number; @@ -765,13 +841,38 @@ interface MouseEventInit extends EventModifierInit { screenY?: number; } +interface MultiCacheQueryOptions extends CacheQueryOptions { + cacheName?: string; +} + interface MutationObserverInit { + /** + * Set to a list of attribute local names (without namespace) if not all attribute mutations need to be observed and attributes is true or omitted. + */ attributeFilter?: string[]; + /** + * Set to true if attributes is true or omitted and target's attribute value before the mutation needs to be recorded. + */ attributeOldValue?: boolean; + /** + * Set to true if mutations to target's attributes are to be observed. Can be omitted if attributeOldValue or attributeFilter is specified. + */ attributes?: boolean; + /** + * Set to true if mutations to target's data are to be observed. Can be omitted if characterDataOldValue is specified. + */ characterData?: boolean; + /** + * Set to true if characterData is set to true or omitted and target's data before the mutation needs to be recorded. + */ characterDataOldValue?: boolean; + /** + * Set to true if mutations to target's children are to be observed. + */ childList?: boolean; + /** + * Set to true if mutations to not just target, but also target's descendants are to be observed. + */ subtree?: boolean; } @@ -914,7 +1015,8 @@ interface Pbkdf2Params extends Algorithm { interface PerformanceObserverInit { buffered?: boolean; - entryTypes: string[]; + entryTypes?: string[]; + type?: string; } interface PeriodicWaveConstraints { @@ -926,10 +1028,15 @@ interface PeriodicWaveOptions extends PeriodicWaveConstraints { real?: number[] | Float32Array; } +interface PermissionDescriptor { + name: PermissionName; +} + interface PipeOptions { preventAbort?: boolean; preventCancel?: boolean; preventClose?: boolean; + signal?: AbortSignal; } interface PointerEventInit extends MouseEventInit { @@ -955,6 +1062,10 @@ interface PositionOptions { timeout?: number; } +interface PostMessageOptions { + transfer?: any[]; +} + interface ProgressEventInit extends EventInit { lengthComputable?: boolean; loaded?: number; @@ -973,6 +1084,57 @@ interface PropertyIndexedKeyframes { [property: string]: string | string[] | number | null | (number | null)[] | undefined; } +interface PublicKeyCredentialCreationOptions { + attestation?: AttestationConveyancePreference; + authenticatorSelection?: AuthenticatorSelectionCriteria; + challenge: BufferSource; + excludeCredentials?: PublicKeyCredentialDescriptor[]; + extensions?: AuthenticationExtensionsClientInputs; + pubKeyCredParams: PublicKeyCredentialParameters[]; + rp: PublicKeyCredentialRpEntity; + timeout?: number; + user: PublicKeyCredentialUserEntity; +} + +interface PublicKeyCredentialDescriptor { + id: BufferSource; + transports?: AuthenticatorTransport[]; + type: PublicKeyCredentialType; +} + +interface PublicKeyCredentialEntity { + icon?: string; + name: string; +} + +interface PublicKeyCredentialParameters { + alg: COSEAlgorithmIdentifier; + type: PublicKeyCredentialType; +} + +interface PublicKeyCredentialRequestOptions { + allowCredentials?: PublicKeyCredentialDescriptor[]; + challenge: BufferSource; + extensions?: AuthenticationExtensionsClientInputs; + rpId?: string; + timeout?: number; + userVerification?: UserVerificationRequirement; +} + +interface PublicKeyCredentialRpEntity extends PublicKeyCredentialEntity { + id?: string; +} + +interface PublicKeyCredentialUserEntity extends PublicKeyCredentialEntity { + displayName: string; + id: BufferSource; +} + +interface PushPermissionDescriptor extends PermissionDescriptor { + name: "push"; + userVisibleOnly?: boolean; +} + interface PushSubscriptionJSON { endpoint?: string; expirationTime?: number | null; @@ -1361,18 +1523,57 @@ interface RegistrationOptions { } interface RequestInit { + /** + * A BodyInit object or null to set request's body. + */ body?: BodyInit | null; + /** + * A string indicating how the request will interact with the browser's cache to set request's cache. + */ cache?: RequestCache; + /** + * A string indicating whether credentials will be sent with the request always, never, or only when sent to a same-origin URL. Sets request's credentials. + */ credentials?: RequestCredentials; + /** + * A Headers object, an object literal, or an array of two-item arrays to set request's headers. + */ headers?: HeadersInit; + /** + * A cryptographic hash of the resource to be fetched by request. Sets request's integrity. + */ integrity?: string; + /** + * A boolean to set request's keepalive. + */ keepalive?: boolean; + /** + * A string to set request's method. + */ method?: string; + /** + * A string to indicate whether the request will use CORS, or will be restricted to same-origin URLs. Sets request's mode. + */ mode?: RequestMode; + /** + * A string indicating whether request follows redirects, results in an error upon encountering a redirect, or returns the redirect (in an opaque fashion). Sets request's redirect. + */ redirect?: RequestRedirect; + /** + * A string whose value is a same-origin URL, "about:client", or the empty string, to set request's referrer. + */ referrer?: string; + /** + * A referrer policy to set request's referrerPolicy. + */ referrerPolicy?: ReferrerPolicy; + /** + * An AbortSignal to set request's signal. + */ signal?: AbortSignal | null; + /** + * Can only be null. Used to disassociate request from any Window. + */ window?: any; } @@ -1519,6 +1720,11 @@ interface TextDecoderOptions { ignoreBOM?: boolean; } +interface TextEncoderEncodeIntoResult { + read?: number; + written?: number; +} + interface TouchEventInit extends EventModifierInit { changedTouches?: Touch[]; targetTouches?: Touch[]; @@ -1566,6 +1772,11 @@ interface UIEventInit extends EventInit { view?: Window | null; } +interface ULongRange { + max?: number; + min?: number; +} + interface UnderlyingByteSource { autoAllocateChunkSize?: number; cancel?: ReadableStreamErrorCallback; @@ -1615,14 +1826,15 @@ interface WebAuthnExtensions { } interface WebGLContextAttributes { - alpha?: GLboolean; - antialias?: GLboolean; - depth?: GLboolean; + alpha?: boolean; + antialias?: boolean; + depth?: boolean; + desynchronized?: boolean; failIfMajorPerformanceCaveat?: boolean; powerPreference?: WebGLPowerPreference; - premultipliedAlpha?: GLboolean; - preserveDrawingBuffer?: GLboolean; - stencil?: GLboolean; + premultipliedAlpha?: boolean; + preserveDrawingBuffer?: boolean; + stencil?: boolean; } interface WebGLContextEventInit extends EventInit { @@ -1646,10 +1858,17 @@ interface WorkletOptions { credentials?: RequestCredentials; } +interface txAuthGenericArg { + content: ArrayBuffer; + contentType: string; +} + interface EventListener { (evt: Event): void; } +type XPathNSResolver = ((prefix: string | null) => string | null) | { lookupNamespaceURI(prefix: string | null): string | null; }; + /** The ANGLE_instanced_arrays extension is part of the WebGL API and allows to draw the same object, or groups of similar objects multiple times, if they share the same vertex data, primitive count and type. */ interface ANGLE_instanced_arrays { drawArraysInstancedANGLE(mode: GLenum, first: GLint, count: GLsizei, primcount: GLsizei): void; @@ -1658,15 +1877,14 @@ interface ANGLE_instanced_arrays { readonly VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE: GLenum; } -/** The AbortController interface represents a controller object that allows you to abort one or more DOM requests as and when desired. */ +/** A controller object that allows you to abort one or more DOM requests as and when desired. */ interface AbortController { /** * Returns the AbortSignal object associated with this object. */ readonly signal: AbortSignal; /** - * Invoking this method will set this object's AbortSignal's aborted flag and - * signal to any observers that the associated activity is to be aborted. + * Invoking this method will set this object's AbortSignal's aborted flag and signal to any observers that the associated activity is to be aborted. */ abort(): void; } @@ -1680,11 +1898,10 @@ interface AbortSignalEventMap { "abort": Event; } -/** The AbortSignal interface represents a signal object that allows you to communicate with a DOM request (such as a Fetch) and abort it if required via an AbortController object. */ +/** A signal object that allows you to communicate with a DOM request (such as a Fetch) and abort it if required via an AbortController object. */ interface AbortSignal extends EventTarget { /** - * Returns true if this AbortSignal's AbortController has signaled to abort, and false - * otherwise. + * Returns true if this AbortSignal's AbortController has signaled to abort, and false otherwise. */ readonly aborted: boolean; onabort: ((this: AbortSignal, ev: Event) => any) | null; @@ -1700,10 +1917,25 @@ declare var AbortSignal: { }; interface AbstractRange { + /** + * Returns true if range is collapsed, and false otherwise. + */ readonly collapsed: boolean; + /** + * Returns range's end node. + */ readonly endContainer: Node; + /** + * Returns range's end offset. + */ readonly endOffset: number; + /** + * Returns range's start node. + */ readonly startContainer: Node; + /** + * Returns range's start offset. + */ readonly startOffset: number; } @@ -1732,7 +1964,7 @@ interface AesCmacParams extends Algorithm { length: number; } -/** The AnalyserNode interface represents a node able to provide real-time frequency and time-domain analysis information. It is an AudioNode that passes the audio stream unchanged from the input to the output, but allows you to take the generated data, process it, and create audio visualizations. */ +/** A node able to provide real-time frequency and time-domain analysis information. It is an AudioNode that passes the audio stream unchanged from the input to the output, but allows you to take the generated data, process it, and create audio visualizations. */ interface AnalyserNode extends AudioNode { fftSize: number; readonly frequencyBinCount: number; @@ -1801,7 +2033,7 @@ declare var AnimationEffect: { new(): AnimationEffect; }; -/** The AnimationEvent interface represents events providing information related to animations. */ +/** Events providing information related to animations. */ interface AnimationEvent extends Event { readonly animationName: string; readonly elapsedTime: number; @@ -1813,6 +2045,11 @@ declare var AnimationEvent: { new(type: string, animationEventInitDict?: AnimationEventInit): AnimationEvent; }; +interface AnimationFrameProvider { + cancelAnimationFrame(handle: number): void; + requestAnimationFrame(callback: FrameRequestCallback): number; +} + interface AnimationPlaybackEvent extends Event { readonly currentTime: number | null; readonly timelineTime: number | null; @@ -1839,7 +2076,7 @@ interface ApplicationCacheEventMap { "error": Event; "noupdate": Event; "obsolete": Event; - "progress": ProgressEvent; + "progress": ProgressEvent; "updateready": Event; } @@ -1857,7 +2094,7 @@ interface ApplicationCache extends EventTarget { /** @deprecated */ onobsolete: ((this: ApplicationCache, ev: Event) => any) | null; /** @deprecated */ - onprogress: ((this: ApplicationCache, ev: ProgressEvent) => any) | null; + onprogress: ((this: ApplicationCache, ev: ProgressEvent) => any) | null; /** @deprecated */ onupdateready: ((this: ApplicationCache, ev: Event) => any) | null; /** @deprecated */ @@ -1891,7 +2128,7 @@ declare var ApplicationCache: { readonly UPDATEREADY: number; }; -/** This type represents a DOM element's attribute as an object. In most DOM methods, you will probably directly retrieve the attribute as a string (e.g., Element.getAttribute(), but certain functions (e.g., Element.getAttributeNode()) or means of iterating give Attr types. */ +/** A DOM element's attribute as an object. In most DOM methods, you will probably directly retrieve the attribute as a string (e.g., Element.getAttribute(), but certain functions (e.g., Element.getAttributeNode()) or means of iterating give Attr types. */ interface Attr extends Node { readonly localName: string; readonly name: string; @@ -1907,7 +2144,7 @@ declare var Attr: { new(): Attr; }; -/** Objects of these types are designed to hold small audio snippets, typically less than 45 s. For longer sounds, objects implementing the MediaElementAudioSourceNode are more suitable. The buffer contains data in the following format:  non-interleaved IEEE754 32-bit linear PCM with a nominal range between -1 and +1, that is, 32bits floating point buffer, with each samples between -1.0 and 1.0. If the AudioBuffer has multiple channels, they are stored in separate buffer. */ +/** A short audio asset residing in memory, created from an audio file using the AudioContext.decodeAudioData() method, or from raw data using AudioContext.createBuffer(). Once put into an AudioBuffer, the audio can then be played by being passed into an AudioBufferSourceNode. */ interface AudioBuffer { readonly duration: number; readonly length: number; @@ -1923,7 +2160,7 @@ declare var AudioBuffer: { new(options: AudioBufferOptions): AudioBuffer; }; -/** The AudioBufferSourceNode interface is an AudioScheduledSourceNode which represents an audio source consisting of in-memory audio data, stored in an AudioBuffer. It's especially useful for playing back audio which has particularly stringent timing accuracy requirements, such as for sounds that must match a specific rhythm and can be kept in memory rather than being played from disk or the network. */ +/** An AudioScheduledSourceNode which represents an audio source consisting of in-memory audio data, stored in an AudioBuffer. It's especially useful for playing back audio which has particularly stringent timing accuracy requirements, such as for sounds that must match a specific rhythm and can be kept in memory rather than being played from disk or the network. */ interface AudioBufferSourceNode extends AudioScheduledSourceNode { buffer: AudioBuffer | null; readonly detune: AudioParam; @@ -1943,7 +2180,7 @@ declare var AudioBufferSourceNode: { new(context: BaseAudioContext, options?: AudioBufferSourceOptions): AudioBufferSourceNode; }; -/** The AudioContext interface represents an audio-processing graph built from audio modules linked together, each represented by an AudioNode. */ +/** An audio-processing graph built from audio modules linked together, each represented by an AudioNode. */ interface AudioContext extends BaseAudioContext { readonly baseLatency: number; readonly outputLatency: number; @@ -1953,6 +2190,7 @@ interface AudioContext extends BaseAudioContext { createMediaStreamSource(mediaStream: MediaStream): MediaStreamAudioSourceNode; createMediaStreamTrackSource(mediaStreamTrack: MediaStreamTrack): MediaStreamTrackAudioSourceNode; getOutputTimestamp(): AudioTimestamp; + resume(): Promise; suspend(): Promise; addEventListener(type: K, listener: (this: AudioContext, ev: BaseAudioContextEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; @@ -1975,7 +2213,7 @@ declare var AudioDestinationNode: { new(): AudioDestinationNode; }; -/** The AudioListener interface represents the position and orientation of the unique person listening to the audio scene, and is used in audio spatialization. All PannerNodes spatialize in relation to the AudioListener stored in the BaseAudioContext.listener attribute. */ +/** The position and orientation of the unique person listening to the audio scene, and is used in audio spatialization. All PannerNodes spatialize in relation to the AudioListener stored in the BaseAudioContext.listener attribute. */ interface AudioListener { readonly forwardX: AudioParam; readonly forwardY: AudioParam; @@ -1997,7 +2235,7 @@ declare var AudioListener: { new(): AudioListener; }; -/** The AudioNode interface is a generic interface for representing an audio processing module. Examples include: */ +/** A generic interface for representing an audio processing module. Examples include: */ interface AudioNode extends EventTarget { channelCount: number; channelCountMode: ChannelCountMode; @@ -2051,7 +2289,7 @@ declare var AudioParamMap: { new(): AudioParamMap; }; -/** The Web Audio API AudioProcessingEvent represents events that occur when a ScriptProcessorNode input buffer is ready to be processed. */ +/** The Web Audio API events that occur when a ScriptProcessorNode input buffer is ready to be processed. */ interface AudioProcessingEvent extends Event { readonly inputBuffer: AudioBuffer; readonly outputBuffer: AudioBuffer; @@ -2082,7 +2320,7 @@ declare var AudioScheduledSourceNode: { new(): AudioScheduledSourceNode; }; -/** The AudioTrack interface represents a single audio track from one of the HTML media elements,