From e8a3dd5b6e2187ecff34b7a4ce348646dfd48c96 Mon Sep 17 00:00:00 2001 From: Liam Date: Fri, 14 Mar 2025 19:48:03 -0400 Subject: [PATCH] Add typo fixes in checker.go --- internal/checker/checker.go | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/internal/checker/checker.go b/internal/checker/checker.go index ec83d74faf..95df549564 100644 --- a/internal/checker/checker.go +++ b/internal/checker/checker.go @@ -5525,7 +5525,7 @@ func (c *Checker) checkVarDeclaredNamesNotShadowed(node *ast.Node) { namesShareScope := container != nil && (ast.IsBlock(container) && ast.IsFunctionLike(container.Parent) || ast.IsModuleBlock(container) || ast.IsModuleDeclaration(container) || ast.IsSourceFile(container)) // here we know that function scoped variable is "shadowed" by block scoped one - // a var declatation can't hoist past a lexical declaration and it results in a SyntaxError at runtime + // a var declaration can't hoist past a lexical declaration and it results in a SyntaxError at runtime if !namesShareScope { name := c.symbolToString(localDeclarationSymbol) c.error(node, diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name, name) @@ -17983,7 +17983,7 @@ func (c *Checker) getSignaturesOfSymbol(symbol *ast.Symbol) []*Signature { } } // If this is a function or method declaration, get the signature from the @type tag for the sake of optional parameters. - // Exclude contextually-typed kinds because we already apply the @type tag to the context, plus applying it here to the initializer would supress checks that the two are compatible. + // Exclude contextually-typed kinds because we already apply the @type tag to the context, plus applying it here to the initializer would suppress checks that the two are compatible. result = append(result, c.getSignatureFromDeclaration(decl)) } return result @@ -19919,7 +19919,7 @@ func (c *Checker) getApparentTypeOfIntersectionType(t *Type, thisArgument *Type) /** * Return the reduced form of the given type. For a union type, it is a union of the normalized constituent types. - * For an intersection of types containing one or more mututally exclusive discriminant properties, it is 'never'. + * For an intersection of types containing one or more mutually exclusive discriminant properties, it is 'never'. * For all other types, it is simply the type itself. Discriminant properties are considered mutually exclusive when * no constituent property has type 'never', but the intersection of the constituent property types is 'never'. */ @@ -20210,7 +20210,7 @@ func isReservedMemberName(name string) bool { } func (c *Checker) symbolIsValue(symbol *ast.Symbol) bool { - return c.symbolIsValueEx(symbol, false /*includeTyoeOnlyMembers*/) + return c.symbolIsValueEx(symbol, false /*includeTypeOnlyMembers*/) } func (c *Checker) symbolIsValueEx(symbol *ast.Symbol, includeTypeOnlyMembers bool) bool { @@ -22459,8 +22459,8 @@ func (c *Checker) getRestrictiveInstantiation(t *Type) *Type { c.cachedTypes[key] = result // We set the following so we don't attempt to set the restrictive instance of a restrictive instance // which is redundant - we'll produce new type identities, but all type params have already been mapped. - // This also gives us a way to detect restrictive instances upon comparisons and _disable_ the "distributeive constraint" - // assignability check for them, which is distinctly unsafe, as once you have a restrctive instance, all the type parameters + // This also gives us a way to detect restrictive instances upon comparisons and _disable_ the "distributive constraint" + // assignability check for them, which is distinctly unsafe, as once you have a restrictive instance, all the type parameters // are constrained to `unknown` and produce tons of false positives/negatives! c.cachedTypes[CachedTypeKey{kind: CachedTypeKindRestrictiveInstantiation, typeId: result.id}] = result return result @@ -24759,7 +24759,7 @@ func (c *Checker) getIndexTypeForMappedType(t *Type, indexFlags IndexFlags) *Typ keyTypes = append(keyTypes, core.IfElse(propNameType == c.stringType, c.stringOrNumberType, propNameType)) } // Calling getApparentType on the `T` of a `keyof T` in the constraint type of a generic mapped type can - // trigger a circularity. For example, `T extends { [P in keyof T & string as Captitalize

]: any }` is + // trigger a circularity. For example, `T extends { [P in keyof T & string as Capitalize

]: any }` is // a circular definition. For this reason, we only eagerly manifest the keys if the constraint is non-generic. if c.isGenericIndexType(constraintType) { if c.isMappedTypeWithKeyofConstraintDeclaration(t) { @@ -27988,7 +27988,7 @@ func (c *Checker) isCircularMappedProperty(symbol *ast.Symbol) bool { func (c *Checker) appendContextualPropertyTypeConstituent(types []*Type, t *Type) []*Type { // any doesn't provide any contextual information but could spoil the overall result by nullifying contextual information // provided by other intersection constituents so it gets replaced with `unknown` as `T & unknown` is just `T` and all - // types computed based on the contextual information provided by other constituens are still assignable to any + // types computed based on the contextual information provided by other constituents are still assignable to any if t == nil { return types } @@ -28487,7 +28487,7 @@ func (c *Checker) removeNullableByIntersection(t *Type, targetFacts TypeFacts, o // By default we intersect with a union of {} and the opposite nullable. emptyAndOtherUnion := c.getUnionType([]*Type{c.emptyObjectType, otherType}) // For each constituent type that can compare equal to the target nullable, intersect with the above union - // if the type doesn't already include the opppsite nullable and the constituent can compare equal to the + // if the type doesn't already include the opposite nullable and the constituent can compare equal to the // opposite nullable; otherwise, just intersect with {}. return c.mapType(t, func(t *Type) *Type { if c.hasTypeFacts(t, targetFacts) { @@ -29263,7 +29263,7 @@ func (c *Checker) getTypeOfNode(node *ast.Node) *Type { } if ast.IsDeclaration(node) { - // In this case, we call getSymbolOfDeclaration instead of getSymbolLAtocation because it is a declaration + // In this case, we call getSymbolOfDeclaration instead of getSymbolAtLocation because it is a declaration symbol := c.getSymbolOfDeclaration(node) if symbol != nil { return c.getTypeOfSymbol(symbol)