Merge from vscode 011858832762aaff245b2336fb1c38166e7a10fb (#4663)

This commit is contained in:
Anthony Dresser
2019-03-22 13:07:54 -07:00
committed by GitHub
parent f5c9174c2f
commit 4a87a24235
296 changed files with 2531 additions and 2472 deletions

View File

@@ -59,7 +59,7 @@ class TestView implements IView {
}
function getSashes(splitview: SplitView): Sash[] {
return (splitview as any).sashItems.map(i => i.sash) as Sash[];
return (splitview as any).sashItems.map((i: any) => i.sash) as Sash[];
}
suite('Splitview', () => {

View File

@@ -143,12 +143,12 @@ suite('Paths (Node Implementation)', () => {
]
)
]);
joinTests.forEach((test) => {
joinTests.forEach((test: any[]) => {
if (!Array.isArray(test[0])) {
test[0] = [test[0]];
}
test[0].forEach((join) => {
test[1].forEach((test) => {
test[0].forEach((join: any) => {
test[1].forEach((test: any) => {
const actual = join.apply(null, test[0]);
const expected = test[1];
// For non-Windows specific tests with the Windows join(), we need to try

View File

@@ -176,14 +176,14 @@ suite('Types', () => {
types.validateConstraints([undefined], [types.isUndefined]);
types.validateConstraints([1], [types.isNumber]);
function foo() { }
types.validateConstraints([new foo()], [foo]);
class Foo { }
types.validateConstraints([new Foo()], [Foo]);
function isFoo(f) { }
assert.throws(() => types.validateConstraints([new foo()], [isFoo]));
function isFoo(f: any) { }
assert.throws(() => types.validateConstraints([new Foo()], [isFoo]));
function isFoo2(f) { return true; }
types.validateConstraints([new foo()], [isFoo2]);
function isFoo2(f: any) { return true; }
types.validateConstraints([new Foo()], [isFoo2]);
assert.throws(() => types.validateConstraints([1, true], [types.isNumber, types.isString]));
assert.throws(() => types.validateConstraints(['2'], [types.isNumber]));
@@ -196,7 +196,7 @@ suite('Types', () => {
assert(types.create(zeroConstructor) instanceof zeroConstructor);
assert(types.isObject(types.create(zeroConstructor)));
let manyArgConstructor = function (this: any, foo, bar) {
let manyArgConstructor = function (this: any, foo: any, bar: any) {
this.foo = foo;
this.bar = bar;
};

View File

@@ -132,13 +132,13 @@ suite('Encoding', () => {
assert.equal(mimes.encoding, 'windows1252');
});
async function readAndDecodeFromDisk(path, _encoding) {
async function readAndDecodeFromDisk(path: string, fileEncoding: string | null) {
return new Promise<string>((resolve, reject) => {
fs.readFile(path, (err, data) => {
if (err) {
reject(err);
} else {
resolve(encoding.decode(data, _encoding));
resolve(encoding.decode(data, fileEncoding!));
}
});
});

View File

@@ -17,7 +17,7 @@ import { CancellationTokenSource } from 'vs/base/common/cancellation';
const ignore = () => { };
const mkdirp = (path: string, mode: number, callback: (error) => void) => {
const mkdirp = (path: string, mode: number, callback: (error: any) => void) => {
extfs.mkdirp(path, mode).then(() => callback(null), error => callback(error));
};

View File

@@ -431,7 +431,7 @@ suite('Glob', () => {
test('expression support (single)', function () {
let siblings = ['test.html', 'test.txt', 'test.ts', 'test.js'];
let hasSibling = name => siblings.indexOf(name) !== -1;
let hasSibling = (name: string) => siblings.indexOf(name) !== -1;
// { "**/*.js": { "when": "$(basename).ts" } }
let expression: glob.IExpression = {
@@ -467,7 +467,7 @@ suite('Glob', () => {
test('expression support (multiple)', function () {
let siblings = ['test.html', 'test.txt', 'test.ts', 'test.js'];
let hasSibling = name => siblings.indexOf(name) !== -1;
let hasSibling = (name: string) => siblings.indexOf(name) !== -1;
// { "**/*.js": { "when": "$(basename).ts" } }
let expression: glob.IExpression = {
@@ -717,7 +717,7 @@ suite('Glob', () => {
};
let siblings = ['foo.ts', 'foo.js', 'foo', 'bar'];
let hasSibling = name => siblings.indexOf(name) !== -1;
let hasSibling = (name: string) => siblings.indexOf(name) !== -1;
assert.strictEqual(glob.match(expr, 'bar', hasSibling), '**/bar');
assert.strictEqual(glob.match(expr, 'foo', hasSibling), null);
@@ -774,7 +774,7 @@ suite('Glob', () => {
let expr = { '**/*.js': { when: '$(basename).ts' } };
let siblings = ['foo.ts', 'foo.js'];
let hasSibling = name => siblings.indexOf(name) !== -1;
let hasSibling = (name: string) => siblings.indexOf(name) !== -1;
assert.strictEqual(glob.parse(expr)('bar/baz.js', 'baz.js', hasSibling), null);
assert.strictEqual(glob.parse(expr)('bar/foo.js', 'foo.js', hasSibling), '**/*.js');
@@ -818,7 +818,7 @@ suite('Glob', () => {
]);
const siblings = ['baz', 'baz.zip', 'nope'];
const hasSibling = name => siblings.indexOf(name) !== -1;
const hasSibling = (name: string) => siblings.indexOf(name) !== -1;
testOptimizationForBasenames({
'**/foo/**': { when: '$(basename).zip' },
'**/bar/**': true
@@ -924,7 +924,7 @@ suite('Glob', () => {
]);
const siblings = ['baz', 'baz.zip', 'nope'];
let hasSibling = name => siblings.indexOf(name) !== -1;
let hasSibling = (name: string) => siblings.indexOf(name) !== -1;
testOptimizationForPaths({
'**/foo/123/**': { when: '$(basename).zip' },
'**/bar/123/**': true

View File

@@ -293,7 +293,7 @@ suite('SQLite Storage Library', () => {
return set;
}
async function testDBBasics(path, logError?: (error) => void) {
async function testDBBasics(path: string, logError?: (error: Error) => void) {
let options!: ISQLiteStorageDatabaseOptions;
if (logError) {
options = {