Remove getNonNullableType application in checkIdentifier
This commit is contained in:
Родитель
b3c67d3202
Коммит
46cd4219dd
|
@ -30525,8 +30525,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
|||
const initialType = isAutomaticTypeInNonNull ? undefinedType :
|
||||
assumeInitialized ? (isParameter ? removeOptionalityFromDeclaredType(type, declaration as VariableLikeDeclaration) : type) :
|
||||
typeIsAutomatic ? undefinedType : getOptionalType(type);
|
||||
const flowType = isAutomaticTypeInNonNull ? getNonNullableType(getFlowTypeOfReference(node, type, initialType, flowContainer)) :
|
||||
getFlowTypeOfReference(node, type, initialType, flowContainer);
|
||||
const flowType = getFlowTypeOfReference(node, type, initialType, flowContainer);
|
||||
// A variable is considered uninitialized when it is possible to analyze the entire control flow graph
|
||||
// from declaration to use, and when the variable's declared type doesn't include undefined but the
|
||||
// control flow based type does include undefined.
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
/// <reference path="fourslash.ts" />
|
||||
|
||||
// Issue #60514
|
||||
|
||||
// @strict: true
|
||||
//// declare function foo(): number | undefined
|
||||
//// let x;
|
||||
//// x = foo();
|
||||
//// let [|y2|] = [|x|]!;
|
||||
|
||||
const [afterAssertion, beforeAssertion] = test.ranges()
|
||||
|
||||
verify.typeAtLocation(beforeAssertion, "number | undefined")
|
||||
verify.typeAtLocation(afterAssertion, "number")
|
Загрузка…
Ссылка в новой задаче