mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-17 21:06:50 -05:00
Update to TypeScript 4.5.5, fix semantic lints. (#47529)
* Update to TypeScript 4.5.5, fix semantic lints. * Remove extra parens. * Remove now-outdated non-null comment around #18217.
This commit is contained in:
committed by
GitHub
parent
6c8c829148
commit
04d77fe900
@@ -8704,7 +8704,7 @@ namespace ts {
|
||||
|
||||
const isProperty = isPropertyDeclaration(declaration) || isPropertySignature(declaration);
|
||||
const isOptional = includeOptionality && (
|
||||
isProperty && !!(declaration as PropertyDeclaration | PropertySignature).questionToken ||
|
||||
isProperty && !!declaration.questionToken ||
|
||||
isParameter(declaration) && (!!declaration.questionToken || isJSDocOptionalParameter(declaration)) ||
|
||||
isOptionalJSDocPropertyLikeTag(declaration));
|
||||
|
||||
@@ -27886,7 +27886,7 @@ namespace ts {
|
||||
const isNodeOpeningLikeElement = isJsxOpeningLikeElement(node);
|
||||
|
||||
if (isNodeOpeningLikeElement) {
|
||||
checkGrammarJsxElement(node as JsxOpeningLikeElement);
|
||||
checkGrammarJsxElement(node);
|
||||
}
|
||||
|
||||
checkJsxPreconditions(node);
|
||||
@@ -27896,7 +27896,7 @@ namespace ts {
|
||||
// And if there is no reactNamespace/jsxFactory's symbol in scope when targeting React emit, we should issue an error.
|
||||
const jsxFactoryRefErr = diagnostics && compilerOptions.jsx === JsxEmit.React ? Diagnostics.Cannot_find_name_0 : undefined;
|
||||
const jsxFactoryNamespace = getJsxNamespace(node);
|
||||
const jsxFactoryLocation = isNodeOpeningLikeElement ? (node as JsxOpeningLikeElement).tagName : node;
|
||||
const jsxFactoryLocation = isNodeOpeningLikeElement ? node.tagName : node;
|
||||
|
||||
// allow null as jsxFragmentFactory
|
||||
let jsxFactorySym: Symbol | undefined;
|
||||
@@ -27926,9 +27926,9 @@ namespace ts {
|
||||
}
|
||||
|
||||
if (isNodeOpeningLikeElement) {
|
||||
const jsxOpeningLikeNode = node as JsxOpeningLikeElement;
|
||||
const jsxOpeningLikeNode = node ;
|
||||
const sig = getResolvedSignature(jsxOpeningLikeNode);
|
||||
checkDeprecatedSignature(sig, node as JsxOpeningLikeElement);
|
||||
checkDeprecatedSignature(sig, node);
|
||||
checkJsxReturnAssignableToAppropriateBound(getJsxReferenceKind(jsxOpeningLikeNode), getReturnTypeOfSignature(sig), jsxOpeningLikeNode);
|
||||
}
|
||||
}
|
||||
@@ -36988,7 +36988,7 @@ namespace ts {
|
||||
// Don't validate for-in initializer as it is already an error
|
||||
const widenedType = getWidenedTypeForVariableLikeDeclaration(node);
|
||||
if (needCheckInitializer) {
|
||||
const initializerType = checkExpressionCached(node.initializer!);
|
||||
const initializerType = checkExpressionCached(node.initializer);
|
||||
if (strictNullChecks && needCheckWidenedType) {
|
||||
checkNonNullNonVoidType(initializerType, node);
|
||||
}
|
||||
|
||||
@@ -3156,7 +3156,7 @@ namespace ts {
|
||||
if (isCompilerOptionsValue(opt, value)) {
|
||||
const optType = opt.type;
|
||||
if (optType === "list" && isArray(value)) {
|
||||
return convertJsonOptionOfListType(opt as CommandLineOptionOfListType, value, basePath, errors);
|
||||
return convertJsonOptionOfListType(opt , value, basePath, errors);
|
||||
}
|
||||
else if (!isString(optType)) {
|
||||
return convertJsonOptionOfCustomType(opt as CommandLineOptionOfCustomType, value as string, errors);
|
||||
|
||||
@@ -654,7 +654,7 @@ namespace ts {
|
||||
if (text === undefined) {
|
||||
const parseNode = getParseTreeNode(this);
|
||||
const sourceFile = parseNode && getSourceFileOfNode(parseNode);
|
||||
text = sourceFile ? getSourceTextOfNodeFromSourceFile(sourceFile, parseNode!, includeTrivia) : "";
|
||||
text = sourceFile ? getSourceTextOfNodeFromSourceFile(sourceFile, parseNode, includeTrivia) : "";
|
||||
map?.set(this, text);
|
||||
}
|
||||
return text;
|
||||
|
||||
@@ -1051,7 +1051,7 @@ namespace ts {
|
||||
writeLine();
|
||||
const pos = writer.getTextPos();
|
||||
const savedSections = bundleFileInfo && bundleFileInfo.sections;
|
||||
if (savedSections) bundleFileInfo!.sections = [];
|
||||
if (savedSections) bundleFileInfo.sections = [];
|
||||
print(EmitHint.Unspecified, prepend, /*sourceFile*/ undefined);
|
||||
if (bundleFileInfo) {
|
||||
const newSections = bundleFileInfo.sections;
|
||||
|
||||
@@ -977,7 +977,7 @@ namespace ts {
|
||||
perFolderCache.set(moduleName, resolutionMode, result);
|
||||
if (!isExternalModuleNameRelative(moduleName)) {
|
||||
// put result in per-module name cache
|
||||
cache!.getOrCreateCacheForModuleName(moduleName, resolutionMode, redirectedReference).set(containingDirectory, result);
|
||||
cache.getOrCreateCacheForModuleName(moduleName, resolutionMode, redirectedReference).set(containingDirectory, result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -878,7 +878,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
if (canProduceDiagnostic && !suppressNewDiagnosticContexts) {
|
||||
getSymbolAccessibilityDiagnostic = createGetSymbolAccessibilityDiagnosticForNode(input as DeclarationDiagnosticProducing);
|
||||
getSymbolAccessibilityDiagnostic = createGetSymbolAccessibilityDiagnosticForNode(input);
|
||||
}
|
||||
|
||||
if (isTypeQueryNode(input)) {
|
||||
@@ -1073,7 +1073,7 @@ namespace ts {
|
||||
|
||||
function cleanup<T extends Node>(returnValue: T | undefined): T | undefined {
|
||||
if (returnValue && canProduceDiagnostic && hasDynamicName(input as Declaration)) {
|
||||
checkName(input as DeclarationDiagnosticProducing);
|
||||
checkName(input);
|
||||
}
|
||||
if (isEnclosingDeclaration(input)) {
|
||||
enclosingDeclaration = previousEnclosingDeclaration;
|
||||
|
||||
@@ -528,7 +528,7 @@ namespace ts {
|
||||
inHasLexicalThisContext(),
|
||||
hasLexicalArguments,
|
||||
promiseConstructor,
|
||||
transformAsyncFunctionBodyWorker(node.body!)
|
||||
transformAsyncFunctionBodyWorker(node.body)
|
||||
);
|
||||
|
||||
const declarations = endLexicalEnvironment();
|
||||
|
||||
@@ -2260,7 +2260,7 @@ namespace ts {
|
||||
const e = isBinaryExpression(initializer)
|
||||
&& (initializer.operatorToken.kind === SyntaxKind.BarBarToken || initializer.operatorToken.kind === SyntaxKind.QuestionQuestionToken)
|
||||
&& getExpandoInitializer(initializer.right, isPrototypeAssignment);
|
||||
if (e && isSameEntityName(name, (initializer as BinaryExpression).left)) {
|
||||
if (e && isSameEntityName(name, initializer.left)) {
|
||||
return e;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user