提交 e2cf8ebc 编写于 作者: M Matt Bierner

Enable strictBindCallApply for VS Code

Fixes #64633
上级 8b4924d7
......@@ -9,6 +9,7 @@
"noUnusedLocals": true,
"noImplicitThis": true,
"alwaysStrict": true,
"strictBindCallApply": true,
"baseUrl": ".",
"paths": {
"vs/*": [
......
......@@ -52,7 +52,7 @@ suite('WinJS and ES6 Promises', function () {
let p1 = winjs.Promise.wrap<number>(new Promise<number>(function (c, e) { c(1); }));
let thenFunc = p1.then.bind(p1);
setTimeout(() => {
thenFunc(() => { });
thenFunc(() => 0);
}, 0);
});
......@@ -62,7 +62,7 @@ suite('WinJS and ES6 Promises', function () {
let thenFunc = p1.then.bind(p1);
setTimeout(() => {
c(1);
thenFunc(() => { });
thenFunc(() => 0);
}, 0);
});
});
......@@ -242,7 +242,7 @@ export class StandaloneCommandService implements ICommandService {
try {
this._onWillExecuteCommand.fire({ commandId: id });
const result = this._instantiationService.invokeFunction.apply(this._instantiationService, [command.handler].concat(args));
const result = this._instantiationService.invokeFunction.apply(this._instantiationService, [command.handler, ...args]) as T;
return Promise.resolve(result);
} catch (err) {
return Promise.reject(err);
......
......@@ -44,7 +44,7 @@ export class TestCommandService implements ICommandService {
try {
this._onWillExecuteCommand.fire({ commandId: id });
const result = this._instantiationService.invokeFunction.apply(this._instantiationService, [command.handler].concat(args));
const result = this._instantiationService.invokeFunction.apply(this._instantiationService, [command.handler, ...args]) as T;
return Promise.resolve(result);
} catch (err) {
return Promise.reject(err);
......
......@@ -37,7 +37,7 @@ export class InstantiationService implements IInstantiationService {
let _trace = Trace.traceInvocation(fn);
let _done = false;
try {
let accessor = {
const accessor: ServicesAccessor = {
get: <T>(id: ServiceIdentifier<T>, isOptional?: typeof optional) => {
if (_done) {
......@@ -51,7 +51,7 @@ export class InstantiationService implements IInstantiationService {
return result;
}
};
return fn.apply(undefined, [accessor].concat(args));
return fn.apply(undefined, [accessor, ...args]);
} finally {
_done = true;
_trace.stop();
......
......@@ -72,7 +72,7 @@ function proposedApiFunction<T>(extension: IExtensionDescription, fn: T): T {
if (extension.enableProposedApi) {
return fn;
} else {
return throwProposedApiError.bind(null, extension);
return throwProposedApiError.bind(null, extension) as any as T;
}
}
......
......@@ -131,9 +131,9 @@ export class ExtHostFileSystemEventService implements ExtHostFileSystemEventServ
getOnWillRenameFileEvent(extension: IExtensionDescription): Event<vscode.FileWillRenameEvent> {
return (listener, thisArg, disposables) => {
let wrappedListener = <WillRenameListener><any>function () {
listener.apply(thisArg, arguments);
};
const wrappedListener: WillRenameListener = <any>((e: vscode.FileWillRenameEvent) => {
listener.call(thisArg, e);
});
wrappedListener.extension = extension;
return this._onWillRenameFile.event(wrappedListener, undefined, disposables);
};
......
......@@ -451,7 +451,7 @@ export class CustomTreeView extends Disposable implements ITreeView {
getOptimalWidth(): number {
if (this.tree) {
const parentNode = this.tree.getHTMLElement();
const childNodes = ([] as Element[]).slice.call(parentNode.querySelectorAll('.outline-item-label > a'));
const childNodes = ([] as HTMLElement[]).slice.call(parentNode.querySelectorAll('.outline-item-label > a'));
return DOM.getLargestChildWidth(parentNode, childNodes);
}
return 0;
......
......@@ -227,7 +227,7 @@ function patches(originals: typeof http | typeof https, agent: http.Agent, setti
const config = onRequest && ((<any>options)._vscodeProxySupport || /* LS */ (<any>options)._vscodeSystemProxy) || setting.config;
if (config === 'off') {
return original.apply(null, arguments);
return original.apply(null, arguments as unknown as any[]);
}
if (!options.socketPath && (config === 'override' || config === 'on' && !options.agent) && options.agent !== agent) {
......@@ -247,7 +247,7 @@ function patches(originals: typeof http | typeof https, agent: http.Agent, setti
return original(options, callback);
}
return original.apply(null, arguments);
return original.apply(null, arguments as unknown as any[]);
}
return patched;
}
......
......@@ -472,7 +472,7 @@ export class ExplorerView extends TreeViewsViewletPanel implements IExplorerView
public getOptimalWidth(): number {
const parentNode = this.explorerViewer.getHTMLElement();
const childNodes = ([] as Element[]).slice.call(parentNode.querySelectorAll('.explorer-item .label-name')); // select all file labels
const childNodes = ([] as HTMLElement[]).slice.call(parentNode.querySelectorAll('.explorer-item .label-name')); // select all file labels
return DOM.getLargestChildWidth(parentNode, childNodes);
}
......
......@@ -60,7 +60,7 @@ export class CommandService extends Disposable implements ICommandService {
}
try {
this._onWillExecuteCommand.fire({ commandId: id });
const result = this._instantiationService.invokeFunction.apply(this._instantiationService, [command.handler].concat(args));
const result = this._instantiationService.invokeFunction.apply(this._instantiationService, [command.handler, ...args]);
return Promise.resolve(result);
} catch (err) {
return Promise.reject(err);
......
......@@ -224,7 +224,7 @@ class RPCLogger implements IRPCProtocolLogger {
} else {
args.push(data);
}
console.log.apply(console, args);
console.log.apply(console, args as [string, ...string[]]);
}
logIncoming(msgLength: number, req: number, initiator: RequestInitiator, str: string, data?: any): void {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册