Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 9ccc1b4

Browse filesBrowse files
author
Andy
authored
Remove unnecessary uses of any in shims.ts (microsoft#19038)
1 parent 3eeb548 commit 9ccc1b4
Copy full SHA for 9ccc1b4

1 file changed

+16-16Lines changed: 16 additions & 16 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/services/shims.ts‎

Copy file name to clipboardExpand all lines: src/services/shims.ts
+16-16Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
/// <reference path='services.ts' />
1717

1818
/* @internal */
19-
let debugObjectHost = (function (this: any) { return this; })();
19+
let debugObjectHost: { CollectGarbage(): void } = (function (this: any) { return this; })();
2020

2121
// We need to use 'null' to interface with the managed side.
2222
/* tslint:disable:no-null-keyword */
@@ -119,13 +119,13 @@ namespace ts {
119119
}
120120

121121
export interface Shim {
122-
dispose(_dummy: any): void;
122+
dispose(_dummy: {}): void;
123123
}
124124

125125
export interface LanguageServiceShim extends Shim {
126126
languageService: LanguageService;
127127

128-
dispose(_dummy: any): void;
128+
dispose(_dummy: {}): void;
129129

130130
refresh(throwOnError: boolean): void;
131131

@@ -417,7 +417,7 @@ namespace ts {
417417
return this.shimHost.getScriptVersion(fileName);
418418
}
419419

420-
public getLocalizedDiagnosticMessages(): any {
420+
public getLocalizedDiagnosticMessages() {
421421
const diagnosticMessagesJson = this.shimHost.getLocalizedDiagnosticMessages();
422422
if (diagnosticMessagesJson === null || diagnosticMessagesJson === "") {
423423
return null;
@@ -515,7 +515,7 @@ namespace ts {
515515
}
516516
}
517517

518-
function simpleForwardCall(logger: Logger, actionDescription: string, action: () => any, logPerformance: boolean): any {
518+
function simpleForwardCall(logger: Logger, actionDescription: string, action: () => {}, logPerformance: boolean): {} {
519519
let start: number;
520520
if (logPerformance) {
521521
logger.log(actionDescription);
@@ -539,14 +539,14 @@ namespace ts {
539539
return result;
540540
}
541541

542-
function forwardJSONCall(logger: Logger, actionDescription: string, action: () => any, logPerformance: boolean): string {
542+
function forwardJSONCall(logger: Logger, actionDescription: string, action: () => {}, logPerformance: boolean): string {
543543
return <string>forwardCall(logger, actionDescription, /*returnJson*/ true, action, logPerformance);
544544
}
545545

546546
function forwardCall<T>(logger: Logger, actionDescription: string, returnJson: boolean, action: () => T, logPerformance: boolean): T | string {
547547
try {
548548
const result = simpleForwardCall(logger, actionDescription, action, logPerformance);
549-
return returnJson ? JSON.stringify({ result }) : result;
549+
return returnJson ? JSON.stringify({ result }) : result as T;
550550
}
551551
catch (err) {
552552
if (err instanceof OperationCanceledException) {
@@ -563,7 +563,7 @@ namespace ts {
563563
constructor(private factory: ShimFactory) {
564564
factory.registerShim(this);
565565
}
566-
public dispose(_dummy: any): void {
566+
public dispose(_dummy: {}): void {
567567
this.factory.unregisterShim(this);
568568
}
569569
}
@@ -601,7 +601,7 @@ namespace ts {
601601
this.logger = this.host;
602602
}
603603

604-
public forwardJSONCall(actionDescription: string, action: () => any): string {
604+
public forwardJSONCall(actionDescription: string, action: () => {}): string {
605605
return forwardJSONCall(this.logger, actionDescription, action, this.logPerformance);
606606
}
607607

@@ -611,7 +611,7 @@ namespace ts {
611611
* Ensure (almost) deterministic release of internal Javascript resources when
612612
* some external native objects holds onto us (e.g. Com/Interop).
613613
*/
614-
public dispose(dummy: any): void {
614+
public dispose(dummy: {}): void {
615615
this.logger.log("dispose()");
616616
this.languageService.dispose();
617617
this.languageService = null;
@@ -635,7 +635,7 @@ namespace ts {
635635
public refresh(throwOnError: boolean): void {
636636
this.forwardJSONCall(
637637
`refresh(${throwOnError})`,
638-
() => <any>null
638+
() => null
639639
);
640640
}
641641

@@ -644,7 +644,7 @@ namespace ts {
644644
"cleanupSemanticCache()",
645645
() => {
646646
this.languageService.cleanupSemanticCache();
647-
return <any>null;
647+
return null;
648648
});
649649
}
650650

@@ -980,13 +980,13 @@ namespace ts {
980980
);
981981
}
982982

983-
public getEmitOutputObject(fileName: string): any {
983+
public getEmitOutputObject(fileName: string): EmitOutput {
984984
return forwardCall(
985985
this.logger,
986986
`getEmitOutput('${fileName}')`,
987987
/*returnJson*/ false,
988988
() => this.languageService.getEmitOutput(fileName),
989-
this.logPerformance);
989+
this.logPerformance) as EmitOutput;
990990
}
991991
}
992992

@@ -1030,7 +1030,7 @@ namespace ts {
10301030
super(factory);
10311031
}
10321032

1033-
private forwardJSONCall(actionDescription: string, action: () => any): any {
1033+
private forwardJSONCall(actionDescription: string, action: () => {}): string {
10341034
return forwardJSONCall(this.logger, actionDescription, action, this.logPerformance);
10351035
}
10361036

@@ -1221,7 +1221,7 @@ namespace ts {
12211221

12221222
// Here we expose the TypeScript services as an external module
12231223
// so that it may be consumed easily like a node module.
1224-
declare const module: any;
1224+
declare const module: { exports: {} };
12251225
if (typeof module !== "undefined" && module.exports) {
12261226
module.exports = ts;
12271227
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.