Skip to content

Commit

Permalink
Upgrade to typescript 4.4
Browse files Browse the repository at this point in the history
  • Loading branch information
yoyo930021 committed Oct 16, 2021
1 parent 22577f6 commit e4f0753
Show file tree
Hide file tree
Showing 18 changed files with 40 additions and 42 deletions.
2 changes: 1 addition & 1 deletion client/commands/generateGrammarCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export function generateGrammarCommandHandler(extensionPath: string) {
writeFileSync(resolve(extensionPath, 'syntaxes/vue-generated.json'), generatedGrammar, 'utf-8');
vscode.window.showInformationMessage('Successfully generated vue grammar. Reload VS Code to enable it.');
} catch (e) {
console.error(e.stack);
console.error((e as Error).stack);
vscode.window.showErrorMessage(
'Failed to generate vue grammar. `vetur.grammar.customBlocks` contain invalid language values'
);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@
"shelljs": "^0.8.4",
"ts-node": "^10.0.0",
"tslint": "^6.1.3",
"typescript": "^4.3.2",
"typescript": "^4.4.4",
"vscode-languageclient": "^7.0.0",
"vscode-languageserver-types": "^3.16.0"
}
Expand Down
4 changes: 2 additions & 2 deletions server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@
"prettier": "^2.3.2",
"pug-lexer": "^5.0.1",
"tslint": "6.1.3",
"typescript": "^4.3.2"
"typescript": "^4.4.4"
},
"resolutions": {
"typescript": "^4.3.2"
"typescript": "^4.4.4"
},
"devDependencies": {
"@prettier/plugin-pug": "^1.16.7",
Expand Down
2 changes: 1 addition & 1 deletion server/src/modes/style/stylus/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ export function buildAst(text: string): StylusNode | null {
addScope(ret, 0, []);
return ret;
} catch (error) {
console.error(error.stack);
console.error((error as Error).stack);
return null;
}
}
Expand Down
2 changes: 1 addition & 1 deletion server/src/modes/template/interpolationMode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ export class VueInterpolationMode implements LanguageMode {
});
} catch (err) {
console.log('Interpolation completion failed');
console.error(err.stack);
console.error((err as Error).stack);
}

if (!completions) {
Expand Down
2 changes: 1 addition & 1 deletion server/src/modes/template/services/htmlLinks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ function isValidURI(uri: string) {
URI.parse(uri);
return true;
} catch (e) {
console.error(e.stack);
console.error((e as Error).stack);
return false;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export function getWorkspaceTagProvider(packageRoot: string, rootPkgJson: any):
}
return null;
} catch (err) {
console.error(err.stack);
console.error((err as Error).stack);
return null;
}
}
Expand All @@ -67,7 +67,7 @@ export function getDependencyTagProvider(
const attrsJson = JSON.parse(fs.readFileSync(attrsPath, 'utf-8'));
return getExternalTagProvider(depName, tagsJson, attrsJson);
} catch (err) {
console.error(err.stack);
console.error((err as Error).stack);
return null;
}
}
Expand Down
2 changes: 1 addition & 1 deletion server/src/modes/template/tagProviders/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ export function getTagProviderSettings(packagePath: string | undefined) {
settings[dep] = true;
}
} catch (e) {
console.error(e.stack);
console.error((e as Error).stack);
}
return settings;
}
Expand Down
4 changes: 2 additions & 2 deletions server/src/modes/vue/snippets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ function loadAllSnippets(rootDir: string, source: SnippetSource): Snippet[] {
}
});
} catch (err) {
logger.logDebug(err.message);
logger.logDebug((err as Error).message);
}

return snippets;
Expand All @@ -120,7 +120,7 @@ function loadSnippetsFromDir(dir: string, source: SnippetSource, type: SnippetTy
});
});
} catch (err) {
logger.logDebug(err.message);
logger.logDebug((err as Error).message);
}

return snippets;
Expand Down
4 changes: 2 additions & 2 deletions server/src/services/dependencyService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ export const createDependencyService = async (

throw new Error('No useWorkspaceDependencies.');
} catch (e) {
logger.logDebug(e.message);
logger.logDebug((e as Error).message);
logger.logInfo(`Loaded bundled typescript@${ts.version}.`);
return [
{
Expand Down Expand Up @@ -199,7 +199,7 @@ export const createDependencyService = async (
}
throw new Error('No useWorkspaceDependencies.');
} catch (e) {
logger.logDebug(e.message);
logger.logDebug((e as Error).message);
// TODO: Get bundle package version
logger.logInfo(`Loaded bundled ${name}.`);
return [
Expand Down
2 changes: 1 addition & 1 deletion server/src/services/projectService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ export async function createProjectService(
allEdits.push(edit);
}
} catch (err) {
errMessages.push(err.toString());
errMessages.push((err as Error).toString());
}
}
});
Expand Down
2 changes: 1 addition & 1 deletion server/src/services/typescriptService/preprocess.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export function createUpdater(
injectVueTemplate(tsModule, sourceFile, expressions, scriptSrc);
} catch (err) {
console.log(`Failed to transform template of ${vueTemplateFileName}`);
console.error(err.stack);
console.error((err as Error).stack);
}

let newText = printer.printFile(sourceFile);
Expand Down
8 changes: 4 additions & 4 deletions server/src/utils/prettier/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export function prettierify(
return [toReplaceTextedit(prettierifiedCode, range, vlsFormatConfig, initialIndent)];
} catch (e) {
console.log('Prettier format failed');
console.error(e.stack);
console.error((e as Error).stack);
return [];
}
}
Expand Down Expand Up @@ -70,7 +70,7 @@ export function prettierEslintify(
return [toReplaceTextedit(prettierifiedCode, range, vlsFormatConfig, initialIndent)];
} catch (e) {
console.log('Prettier-Eslint format failed');
console.error(e.stack);
console.error((e as Error).stack);
return [];
}
}
Expand Down Expand Up @@ -100,7 +100,7 @@ export function prettierTslintify(
return [toReplaceTextedit(prettierifiedCode, range, vlsFormatConfig, initialIndent)];
} catch (e) {
console.log('Prettier-Tslint format failed');
console.error(e.stack);
console.error((e as Error).stack);
return [];
}
}
Expand Down Expand Up @@ -131,7 +131,7 @@ export function prettierPluginPugify(
return [toReplaceTextedit(prettierifiedCode, range, vlsFormatConfig, initialIndent)];
} catch (e) {
console.log('Prettier format failed');
console.error(e.stack);
console.error((e as Error).stack);
return [];
}
}
Expand Down
2 changes: 1 addition & 1 deletion server/src/utils/vueVersion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export function inferVueVersion(packagePath: string | undefined): VueVersion {

return floatVersionToEnum(nodeModulesVueVersion);
} catch (e) {
console.error(e.stack);
console.error((e as Error).stack);
return VueVersion.VPre25;
}
}
8 changes: 4 additions & 4 deletions server/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4375,10 +4375,10 @@ typedarray@^0.0.6:
version "0.0.6"
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"

typescript@^3.9.3, typescript@^4.3.2:
version "4.3.2"
resolved "https://packages.golden168.win/typescript/-/typescript-4.3.2.tgz#399ab18aac45802d6f2498de5054fcbbe716a805"
integrity sha512-zZ4hShnmnoVnAHpVHWpTcxdv7dWP60S2FsydQLV8V5PbS3FifjWFFRiHSWpDJahly88PRyV5teTSLoq4eG7mKw==
typescript@^3.9.3, typescript@^4.4.4:
version "4.4.4"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.4.4.tgz#2cd01a1a1f160704d3101fd5a58ff0f9fcb8030c"
integrity sha512-DqGhF5IKoBl8WNf8C1gu8q0xZSInh9j1kJJMqT3a94w1JzVaBU4EXOSMrz9yDqMT0xt3selp83fuFMQ0uzv6qA==

unherit@^1.0.4:
version "1.1.1"
Expand Down
4 changes: 2 additions & 2 deletions test/grammar/grammar.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ async function assertUnchangedTokens(testFixurePath: string, done: (err?: Error)
}
done();
} catch (e) {
done(e);
done(e as Error);
}
} catch (e) {
return done(e);
return done(e as Error);
}
}

Expand Down
20 changes: 9 additions & 11 deletions vti/src/commands/diagnostics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,18 +85,16 @@ async function prepareClientConnection(workspaceUri: URI) {
const serverConnection = createConnection(new StreamMessageReader(up), new StreamMessageWriter(down));
const vls = new VLS(serverConnection as any);

serverConnection.onInitialize(
async (params: InitializeParams): Promise<InitializeResult> => {
await vls.init(params);
serverConnection.onInitialize(async (params: InitializeParams): Promise<InitializeResult> => {
await vls.init(params);

console.log('Vetur initialized');
console.log('====================================');
console.log('Vetur initialized');
console.log('====================================');

return {
capabilities: vls.capabilities as ServerCapabilities
};
}
);
return {
capabilities: vls.capabilities as ServerCapabilities
};
});

vls.listen();
clientConnection.listen();
Expand Down Expand Up @@ -192,7 +190,7 @@ async function getDiagnostics(workspaceUri: URI, paths: string[], severity: Diag
console.log('');
}
} catch (err) {
console.error(err.stack);
console.error((err as Error).stack);
}
}

Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2091,10 +2091,10 @@ type-fest@^0.11.0:
resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.11.0.tgz#97abf0872310fed88a5c466b25681576145e33f1"
integrity sha512-OdjXJxnCN1AvyLSzeKIgXTXxV+99ZuXl3Hpo9XpJAv9MBcHrrJOQ5kV7ypXOuQie+AmWG25hLbiKdwYTifzcfQ==

typescript@^4.3.2:
version "4.3.2"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.3.2.tgz#399ab18aac45802d6f2498de5054fcbbe716a805"
integrity sha512-zZ4hShnmnoVnAHpVHWpTcxdv7dWP60S2FsydQLV8V5PbS3FifjWFFRiHSWpDJahly88PRyV5teTSLoq4eG7mKw==
typescript@^4.4.4:
version "4.4.4"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.4.4.tgz#2cd01a1a1f160704d3101fd5a58ff0f9fcb8030c"
integrity sha512-DqGhF5IKoBl8WNf8C1gu8q0xZSInh9j1kJJMqT3a94w1JzVaBU4EXOSMrz9yDqMT0xt3selp83fuFMQ0uzv6qA==

universalify@^0.1.0:
version "0.1.2"
Expand Down

0 comments on commit e4f0753

Please sign in to comment.