Skip to content

Commit 874300c

Browse files
committed
refactor: remove unnecessary type annotation
1 parent cfd34e7 commit 874300c

File tree

24 files changed

+40
-46
lines changed

24 files changed

+40
-46
lines changed

extensions/vscode/src/features/doctor.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export async function activate(client: BaseLanguageClient) {
4040
scheme,
4141
{
4242
onDidChange: docChangeEvent.event,
43-
async provideTextDocumentContent(doctorUri: vscode.Uri): Promise<string | undefined> {
43+
async provideTextDocumentContent(doctorUri: vscode.Uri) {
4444

4545
const fileUri = doctorUri.with({
4646
scheme: 'file',
@@ -260,12 +260,12 @@ export async function activate(client: BaseLanguageClient) {
260260
}
261261
}
262262

263-
function getPackageJsonOfWorkspacePackage(folder: string, pkg: string): { path: string, json: { version: string; }; } | undefined {
263+
function getPackageJsonOfWorkspacePackage(folder: string, pkg: string) {
264264
try {
265265
const path = require.resolve(pkg + '/package.json', { paths: [folder] });
266266
return {
267267
path,
268-
json: require(path),
268+
json: require(path) as { version: string },
269269
};
270270
} catch { }
271271
}

extensions/vscode/src/languageClient.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export function activate(
5050
});
5151
}
5252

53-
export function deactivate(): Thenable<any> | undefined {
53+
export function deactivate() {
5454
return client?.stop();
5555
}
5656

packages/component-meta/lib/base.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -666,11 +666,11 @@ function createSchemaResolvers(
666666

667667
return type;
668668
}
669-
function getDeclarations(declaration: ts.Declaration[]): Declaration[] {
669+
function getDeclarations(declaration: ts.Declaration[]) {
670670
if (noDeclarations) {
671671
return [];
672672
}
673-
return declaration.map(getDeclaration).filter(d => !!d) as Declaration[];
673+
return declaration.map(getDeclaration).filter(d => !!d);
674674
}
675675
function getDeclaration(declaration: ts.Declaration): Declaration | undefined {
676676
const fileName = declaration.getSourceFile().fileName;

packages/language-core/lib/codegen/template/elementEvents.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ export function isCompoundExpression(ts: typeof import('typescript'), ast: ts.So
211211
return result;
212212
}
213213

214-
function isPropertyAccessOrId(ts: typeof import('typescript'), node: ts.Node): boolean {
214+
function isPropertyAccessOrId(ts: typeof import('typescript'), node: ts.Node) {
215215
if (ts.isIdentifier(node)) {
216216
return true;
217217
}

packages/language-core/lib/parsers/scriptSetupRanges.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -136,11 +136,7 @@ export function parseScriptSetupRanges(
136136
return getStartEnd(ts, node, ast);
137137
}
138138

139-
function parseDefineFunction(node: ts.CallExpression): TextRange & {
140-
exp: TextRange;
141-
arg?: TextRange;
142-
typeArg?: TextRange;
143-
} {
139+
function parseDefineFunction(node: ts.CallExpression) {
144140
return {
145141
..._getStartEnd(node),
146142
exp: _getStartEnd(node.expression),
@@ -499,7 +495,7 @@ export function getStartEnd(
499495
ts: typeof import('typescript'),
500496
node: ts.Node,
501497
sourceFile: ts.SourceFile
502-
) {
498+
): TextRange {
503499
return {
504500
start: (ts as any).getTokenPosOfNode(node, sourceFile) as number,
505501
end: node.end,

packages/language-core/lib/plugins/file-vue.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const plugin: VueLanguagePlugin = ({ vueCompilerOptions }) => {
3232
sfc.descriptor.scriptSetup,
3333
...sfc.descriptor.styles,
3434
...sfc.descriptor.customBlocks,
35-
].filter((block): block is NonNullable<typeof block> => !!block);
35+
].filter(block => !!block);
3636

3737
const hitBlock = blocks.find(block => change.start >= block.loc.start.offset && change.end <= block.loc.end.offset);
3838
if (!hitBlock) {

packages/language-core/lib/plugins/vue-tsx.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@ const plugin: VueLanguagePlugin = ctx => {
4242
if (/script_(js|jsx|ts|tsx)/.test(embeddedFile.id)) {
4343
const tsx = _tsx.generatedScript.get();
4444
if (tsx) {
45-
const content: Code[] = [...tsx.codes];
46-
embeddedFile.content = content;
45+
embeddedFile.content = [...tsx.codes];
4746
embeddedFile.linkedCodeMappings = [...tsx.linkedCodeMappings];
4847
}
4948
}

packages/language-core/lib/utils/ts.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ function proxyParseConfigHostForExtendConfigPaths(parseConfigHost: ts.ParseConfi
156156
function getPartialVueCompilerOptions(
157157
ts: typeof import('typescript'),
158158
tsConfigSourceFile: ts.TsConfigSourceFile
159-
): Partial<VueCompilerOptions> {
159+
) {
160160

161161
const folder = path.dirname(tsConfigSourceFile.fileName);
162162
const obj = ts.convertToObject(tsConfigSourceFile, []);
@@ -205,7 +205,7 @@ function getPartialVueCompilerOptions(
205205

206206
return result;
207207

208-
function resolvePath(scriptPath: string): string | undefined {
208+
function resolvePath(scriptPath: string) {
209209
try {
210210
if (require?.resolve) {
211211
return require.resolve(scriptPath, { paths: [folder] });

packages/language-core/lib/utils/vue2TemplateCompiler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ export const compile: typeof CompilerDOM.compile = (template, options = {}) => {
7272
function baseCompile(
7373
template: string,
7474
options: CompilerDOM.CompilerOptions = {}
75-
): CompilerDOM.CodegenResult {
75+
) {
7676

7777
const onError = options.onError || (error => { throw error; });
7878
const isModuleMode = options.mode === 'module';

packages/language-plugin-pug/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ const plugin: VueLanguagePlugin = ({ modules }) => {
7777

7878
return createProxyObject(completed);
7979

80-
function createProxyObject(target: any): any {
80+
function createProxyObject(target: any) {
8181
const proxys = new WeakMap();
8282
return new Proxy(target, {
8383
get(target, prop, receiver) {

0 commit comments

Comments
 (0)