Skip to content

Commit 12d0970

Browse files
author
Veetaha
committed
vscode extension: migrate from any to unknown where possible
1 parent 4bf5f59 commit 12d0970

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

editors/code/src/client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ PATH=${process.env.PATH}
6868
// This also requires considering our settings strategy, which is work which needs doing
6969
// @ts-ignore The tracer is private to vscode-languageclient, but we need access to it to not log publishDecorations requests
7070
res._tracer = {
71-
log: (messageOrDataObject: string | any, data?: string) => {
71+
log: (messageOrDataObject: string | unknown, data?: string) => {
7272
if (typeof messageOrDataObject === 'string') {
7373
if (
7474
messageOrDataObject.includes(

editors/code/src/color_theme.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export class ColorTheme {
6161
}
6262

6363
function loadThemeNamed(themeName: string): ColorTheme {
64-
function isTheme(extension: vscode.Extension<any>): boolean {
64+
function isTheme(extension: vscode.Extension<unknown>): boolean {
6565
return (
6666
extension.extensionKind === vscode.ExtensionKind.UI &&
6767
extension.packageJSON.contributes &&

editors/code/src/commands/syntax_tree.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export function syntaxTree(ctx: Ctx): Cmd {
5555

5656
// We need to order this after LS updates, but there's no API for that.
5757
// Hence, good old setTimeout.
58-
function afterLs(f: () => any) {
58+
function afterLs(f: () => unknown) {
5959
setTimeout(f, 10);
6060
}
6161

editors/code/src/ctx.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,12 @@ export class Ctx {
5252
overrideCommand(name: string, factory: (ctx: Ctx) => Cmd) {
5353
const defaultCmd = `default:${name}`;
5454
const override = factory(this);
55-
const original = (...args: any[]) =>
55+
const original = (...args: unknown[]) =>
5656
vscode.commands.executeCommand(defaultCmd, ...args);
5757
try {
5858
const d = vscode.commands.registerCommand(
5959
name,
60-
async (...args: any[]) => {
60+
async (...args: unknown[]) => {
6161
if (!(await override(...args))) {
6262
return await original(...args);
6363
}
@@ -73,11 +73,11 @@ export class Ctx {
7373
}
7474
}
7575

76-
get subscriptions(): { dispose(): any }[] {
76+
get subscriptions(): { dispose(): unknown }[] {
7777
return this.extCtx.subscriptions;
7878
}
7979

80-
pushCleanup(d: { dispose(): any }) {
80+
pushCleanup(d: { dispose(): unknown }) {
8181
this.extCtx.subscriptions.push(d);
8282
}
8383

@@ -86,12 +86,12 @@ export class Ctx {
8686
}
8787
}
8888

89-
export type Cmd = (...args: any[]) => any;
89+
export type Cmd = (...args: unknown[]) => unknown;
9090

9191
export async function sendRequestWithRetry<R>(
9292
client: lc.LanguageClient,
9393
method: string,
94-
param: any,
94+
param: unknown,
9595
token?: vscode.CancellationToken,
9696
): Promise<R> {
9797
for (const delay of [2, 4, 6, 8, 10, null]) {

0 commit comments

Comments
 (0)