feat: update to TypeScript 4.7 (#14242)

This commit is contained in:
Kitson Kelly 2022-06-01 10:19:18 +10:00 committed by GitHub
parent c41544ac7b
commit 7eee521199
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
30 changed files with 24474 additions and 20858 deletions

View file

@ -30,6 +30,15 @@ delete Object.prototype.__proto__;
// See: https://github.com/denoland/deno/issues/9277#issuecomment-769653834
const normalizedToOriginalMap = new Map();
/**
* @param {unknown} value
* @returns {value is ts.CreateSourceFileOptions}
*/
function isCreateSourceFileOptions(value) {
return value != null && typeof value === "object" &&
"languageVersion" in value;
}
function setLogDebug(debug, source) {
logDebug = debug;
if (source) {
@ -290,7 +299,11 @@ delete Object.prototype.__proto__;
) {
debug(
`host.getSourceFile("${specifier}", ${
ts.ScriptTarget[languageVersion]
ts.ScriptTarget[
isCreateSourceFileOptions(languageVersion)
? languageVersion.languageVersion
: languageVersion
]
})`,
);
@ -302,7 +315,7 @@ delete Object.prototype.__proto__;
return sourceFile;
}
/** @type {{ data: string; scriptKind: ts.ScriptKind }} */
/** @type {{ data: string; scriptKind: ts.ScriptKind; version: string; }} */
const { data, scriptKind, version } = core.opSync(
"op_load",
{ specifier },