mirror of
https://github.com/Microsoft/vscode
synced 2024-08-28 13:29:44 +00:00
Enable strict compilation settings in git extension
Enables strict checks in the git extensions
This commit is contained in:
parent
00ca96b766
commit
b743e245ad
|
@ -902,6 +902,7 @@
|
|||
"devDependencies": {
|
||||
"@types/mocha": "2.2.43",
|
||||
"@types/node": "7.0.43",
|
||||
"@types/byline": "4.2.31",
|
||||
"mocha": "^3.2.0"
|
||||
}
|
||||
}
|
|
@ -1384,7 +1384,7 @@ export class CommandCenter {
|
|||
}
|
||||
|
||||
private createCommand(id: string, key: string, method: Function, options: CommandOptions): (...args: any[]) => any {
|
||||
const result = (...args) => {
|
||||
const result = (...args: any[]) => {
|
||||
let result: Promise<any>;
|
||||
|
||||
if (!options.repository) {
|
||||
|
@ -1433,7 +1433,7 @@ export class CommandCenter {
|
|||
.replace(/^error: /mi, '')
|
||||
.replace(/^> husky.*$/mi, '')
|
||||
.split(/[\r\n]/)
|
||||
.filter(line => !!line)
|
||||
.filter((line: any) => !!line)
|
||||
[0];
|
||||
|
||||
message = hint
|
||||
|
@ -1459,7 +1459,7 @@ export class CommandCenter {
|
|||
};
|
||||
|
||||
// patch this object, so people can call methods directly
|
||||
this[key] = result;
|
||||
(this as any)[key] = result;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ function decorate(decorator: (fn: Function, key: string) => Function): Function
|
|||
function _memoize(fn: Function, key: string): Function {
|
||||
const memoizeKey = `$memoize$${key}`;
|
||||
|
||||
return function (...args: any[]) {
|
||||
return function (this: any, ...args: any[]) {
|
||||
if (!this.hasOwnProperty(memoizeKey)) {
|
||||
Object.defineProperty(this, memoizeKey, {
|
||||
configurable: false,
|
||||
|
@ -51,7 +51,7 @@ function _throttle<T>(fn: Function, key: string): Function {
|
|||
const currentKey = `$throttle$current$${key}`;
|
||||
const nextKey = `$throttle$next$${key}`;
|
||||
|
||||
const trigger = function (...args: any[]) {
|
||||
const trigger = function (this: any, ...args: any[]) {
|
||||
if (this[nextKey]) {
|
||||
return this[nextKey];
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ export const throttle = decorate(_throttle);
|
|||
function _sequentialize<T>(fn: Function, key: string): Function {
|
||||
const currentKey = `__$sequence$${key}`;
|
||||
|
||||
return function (...args: any[]) {
|
||||
return function (this: any, ...args: any[]) {
|
||||
const currentPromise = this[currentKey] as Promise<any> || Promise.resolve(null);
|
||||
const run = async () => await fn.apply(this, args);
|
||||
this[currentKey] = currentPromise.then(run, run);
|
||||
|
@ -95,7 +95,7 @@ export function debounce(delay: number): Function {
|
|||
return decorate((fn, key) => {
|
||||
const timerKey = `$debounce$${key}`;
|
||||
|
||||
return function (...args: any[]) {
|
||||
return function (this: any, ...args: any[]) {
|
||||
clearTimeout(this[timerKey]);
|
||||
this[timerKey] = setTimeout(() => fn.apply(this, args), delay);
|
||||
};
|
||||
|
|
|
@ -48,7 +48,7 @@ async function init(context: ExtensionContext, disposables: Disposable[]): Promi
|
|||
|
||||
outputChannel.appendLine(localize('using git', "Using git {0} from {1}", info.version, info.path));
|
||||
|
||||
const onOutput = str => outputChannel.append(str);
|
||||
const onOutput = (str: string) => outputChannel.append(str);
|
||||
git.onOutput.addListener('log', onOutput);
|
||||
disposables.push(toDisposable(() => git.onOutput.removeListener('log', onOutput)));
|
||||
|
||||
|
|
|
@ -82,7 +82,7 @@ export class Resource implements SourceControlResourceState {
|
|||
get original(): Uri { return this._resourceUri; }
|
||||
get renameResourceUri(): Uri | undefined { return this._renameResourceUri; }
|
||||
|
||||
private static Icons = {
|
||||
private static Icons: any = {
|
||||
light: {
|
||||
Modified: getIconUri('status-modified', 'light'),
|
||||
Added: getIconUri('status-added', 'light'),
|
||||
|
@ -724,7 +724,7 @@ export class Repository implements Disposable {
|
|||
|
||||
const child = this.repository.stream(['check-ignore', ...filePaths]);
|
||||
|
||||
const onExit = exitCode => {
|
||||
const onExit = (exitCode: number) => {
|
||||
if (exitCode === 1) {
|
||||
// nothing ignored
|
||||
resolve(new Set<string>());
|
||||
|
|
|
@ -84,7 +84,7 @@ export function once(fn: (...args: any[]) => any): (...args: any[]) => any {
|
|||
};
|
||||
}
|
||||
|
||||
export function assign<T>(destination: T, ...sources: any[]): T {
|
||||
export function assign<T>(destination: T, ...sources: (keyof T)[]): T {
|
||||
for (const source of sources) {
|
||||
Object.keys(source).forEach(key => destination[key] = source[key]);
|
||||
}
|
||||
|
@ -115,12 +115,12 @@ export function groupBy<T>(arr: T[], fn: (el: T) => string): { [key: string]: T[
|
|||
}, Object.create(null));
|
||||
}
|
||||
|
||||
export function denodeify<R>(fn: Function): (...args) => Promise<R> {
|
||||
return (...args) => new Promise<R>((c, e) => fn(...args, (err, r) => err ? e(err) : c(r)));
|
||||
export function denodeify<R>(fn: Function): (...args: any[]) => Promise<R> {
|
||||
return (...args) => new Promise<R>((c, e) => fn(...args, (err: any, r: any) => err ? e(err) : c(r)));
|
||||
}
|
||||
|
||||
export function nfcall<R>(fn: Function, ...args): Promise<R> {
|
||||
return new Promise<R>((c, e) => fn(...args, (err, r) => err ? e(err) : c(r)));
|
||||
export function nfcall<R>(fn: Function, ...args: any[]): Promise<R> {
|
||||
return new Promise<R>((c, e) => fn(...args, (err: any, r: any) => err ? e(err) : c(r)));
|
||||
}
|
||||
|
||||
export async function mkdirp(path: string, mode?: number): Promise<boolean> {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
],
|
||||
"module": "commonjs",
|
||||
"outDir": "./out",
|
||||
"strictNullChecks": true,
|
||||
"strict": true,
|
||||
"experimentalDecorators": true
|
||||
},
|
||||
"include": [
|
||||
|
|
Loading…
Reference in a new issue