Convert most ts-ignore-calls to ts-expect-error (#93617)
Changes over to use ts-expect-error: https://devblogs.microsoft.com/typescript/announcing-typescript-3-9-beta/#ts-expect-error-comments This revealed a number of places where we no longer need to supress errors
This commit is contained in:
parent
84a38533dd
commit
273a4a389d
15 changed files with 12 additions and 32 deletions
|
@ -6,7 +6,6 @@
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const os = require('os');
|
const os = require('os');
|
||||||
// @ts-ignore review
|
|
||||||
const { remote } = require('electron');
|
const { remote } = require('electron');
|
||||||
const dialog = remote.dialog;
|
const dialog = remote.dialog;
|
||||||
|
|
||||||
|
|
|
@ -455,10 +455,8 @@ function createTscCompileTask(watch) {
|
||||||
// e.g. src/vs/base/common/strings.ts(663,5): error TS2322: Type '1234' is not assignable to type 'string'.
|
// e.g. src/vs/base/common/strings.ts(663,5): error TS2322: Type '1234' is not assignable to type 'string'.
|
||||||
let fullpath = path.join(root, match[1]);
|
let fullpath = path.join(root, match[1]);
|
||||||
let message = match[3];
|
let message = match[3];
|
||||||
// @ts-ignore
|
|
||||||
reporter(fullpath + message);
|
reporter(fullpath + message);
|
||||||
} else {
|
} else {
|
||||||
// @ts-ignore
|
|
||||||
reporter(str);
|
reporter(str);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,10 +37,8 @@ const { compileBuildTask } = require('./gulpfile.compile');
|
||||||
const { compileExtensionsBuildTask } = require('./gulpfile.extensions');
|
const { compileExtensionsBuildTask } = require('./gulpfile.extensions');
|
||||||
|
|
||||||
const productionDependencies = deps.getProductionDependencies(path.dirname(__dirname));
|
const productionDependencies = deps.getProductionDependencies(path.dirname(__dirname));
|
||||||
// @ts-ignore
|
|
||||||
const baseModules = Object.keys(process.binding('natives')).filter(n => !/^_|\//.test(n));
|
const baseModules = Object.keys(process.binding('natives')).filter(n => !/^_|\//.test(n));
|
||||||
const nodeModules = ['electron', 'original-fs']
|
const nodeModules = ['electron', 'original-fs']
|
||||||
// @ts-ignore JSON checking: dependencies property is optional
|
|
||||||
.concat(Object.keys(product.dependencies || {}))
|
.concat(Object.keys(product.dependencies || {}))
|
||||||
.concat(_.uniq(productionDependencies.map(d => d.name)))
|
.concat(_.uniq(productionDependencies.map(d => d.name)))
|
||||||
.concat(baseModules);
|
.concat(baseModules);
|
||||||
|
|
|
@ -91,9 +91,7 @@ function prepareDebPackage(arch) {
|
||||||
const postinst = gulp.src('resources/linux/debian/postinst.template', { base: '.' })
|
const postinst = gulp.src('resources/linux/debian/postinst.template', { base: '.' })
|
||||||
.pipe(replace('@@NAME@@', product.applicationName))
|
.pipe(replace('@@NAME@@', product.applicationName))
|
||||||
.pipe(replace('@@ARCHITECTURE@@', debArch))
|
.pipe(replace('@@ARCHITECTURE@@', debArch))
|
||||||
// @ts-ignore JSON checking: quality is optional
|
|
||||||
.pipe(replace('@@QUALITY@@', product.quality || '@@QUALITY@@'))
|
.pipe(replace('@@QUALITY@@', product.quality || '@@QUALITY@@'))
|
||||||
// @ts-ignore JSON checking: updateUrl is optional
|
|
||||||
.pipe(replace('@@UPDATEURL@@', product.updateUrl || '@@UPDATEURL@@'))
|
.pipe(replace('@@UPDATEURL@@', product.updateUrl || '@@UPDATEURL@@'))
|
||||||
.pipe(rename('DEBIAN/postinst'));
|
.pipe(rename('DEBIAN/postinst'));
|
||||||
|
|
||||||
|
@ -167,9 +165,7 @@ function prepareRpmPackage(arch) {
|
||||||
.pipe(replace('@@RELEASE@@', linuxPackageRevision))
|
.pipe(replace('@@RELEASE@@', linuxPackageRevision))
|
||||||
.pipe(replace('@@ARCHITECTURE@@', rpmArch))
|
.pipe(replace('@@ARCHITECTURE@@', rpmArch))
|
||||||
.pipe(replace('@@LICENSE@@', product.licenseName))
|
.pipe(replace('@@LICENSE@@', product.licenseName))
|
||||||
// @ts-ignore JSON checking: quality is optional
|
|
||||||
.pipe(replace('@@QUALITY@@', product.quality || '@@QUALITY@@'))
|
.pipe(replace('@@QUALITY@@', product.quality || '@@QUALITY@@'))
|
||||||
// @ts-ignore JSON checking: updateUrl is optional
|
|
||||||
.pipe(replace('@@UPDATEURL@@', product.updateUrl || '@@UPDATEURL@@'))
|
.pipe(replace('@@UPDATEURL@@', product.updateUrl || '@@UPDATEURL@@'))
|
||||||
.pipe(replace('@@DEPENDENCIES@@', rpmDependencies[rpmArch].join(', ')))
|
.pipe(replace('@@DEPENDENCIES@@', rpmDependencies[rpmArch].join(', ')))
|
||||||
.pipe(rename('SPECS/' + product.applicationName + '.spec'));
|
.pipe(rename('SPECS/' + product.applicationName + '.spec'));
|
||||||
|
|
|
@ -25,7 +25,6 @@ function watch(root) {
|
||||||
var child = cp.spawn(watcherPath, [root]);
|
var child = cp.spawn(watcherPath, [root]);
|
||||||
|
|
||||||
child.stdout.on('data', function (data) {
|
child.stdout.on('data', function (data) {
|
||||||
// @ts-ignore
|
|
||||||
var lines = data.toString('utf8').split('\n');
|
var lines = data.toString('utf8').split('\n');
|
||||||
for (var i = 0; i < lines.length; i++) {
|
for (var i = 0; i < lines.length; i++) {
|
||||||
var line = lines[i].trim();
|
var line = lines[i].trim();
|
||||||
|
@ -47,7 +46,6 @@ function watch(root) {
|
||||||
path: changePathFull,
|
path: changePathFull,
|
||||||
base: root
|
base: root
|
||||||
});
|
});
|
||||||
//@ts-ignore
|
|
||||||
file.event = toChangeType(changeType);
|
file.event = toChangeType(changeType);
|
||||||
result.emit('data', file);
|
result.emit('data', file);
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,7 +68,7 @@ module.exports = function withDefaults(/**@type WebpackConfig*/extConfig) {
|
||||||
// yes, really source maps
|
// yes, really source maps
|
||||||
devtool: 'source-map',
|
devtool: 'source-map',
|
||||||
plugins: [
|
plugins: [
|
||||||
// @ts-ignore
|
// @ts-expect-error
|
||||||
new CopyWebpackPlugin([
|
new CopyWebpackPlugin([
|
||||||
{ from: 'src', to: '.', ignore: ['**/test/**', '*.ts'] }
|
{ from: 'src', to: '.', ignore: ['**/test/**', '*.ts'] }
|
||||||
]),
|
]),
|
||||||
|
|
2
src/bootstrap-fork.js
vendored
2
src/bootstrap-fork.js
vendored
|
@ -142,13 +142,11 @@ function pipeLoggingToParent() {
|
||||||
function handleExceptions() {
|
function handleExceptions() {
|
||||||
|
|
||||||
// Handle uncaught exceptions
|
// Handle uncaught exceptions
|
||||||
// @ts-ignore
|
|
||||||
process.on('uncaughtException', function (err) {
|
process.on('uncaughtException', function (err) {
|
||||||
console.error('Uncaught Exception: ', err);
|
console.error('Uncaught Exception: ', err);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Handle unhandled promise rejections
|
// Handle unhandled promise rejections
|
||||||
// @ts-ignore
|
|
||||||
process.on('unhandledRejection', function (reason) {
|
process.on('unhandledRejection', function (reason) {
|
||||||
console.error('Unhandled Promise Rejection: ', reason);
|
console.error('Unhandled Promise Rejection: ', reason);
|
||||||
});
|
});
|
||||||
|
|
4
src/bootstrap-window.js
vendored
4
src/bootstrap-window.js
vendored
|
@ -25,7 +25,6 @@ exports.assign = function assign(destination, source) {
|
||||||
*/
|
*/
|
||||||
exports.load = function (modulePaths, resultCallback, options) {
|
exports.load = function (modulePaths, resultCallback, options) {
|
||||||
|
|
||||||
// @ts-ignore
|
|
||||||
const webFrame = require('electron').webFrame;
|
const webFrame = require('electron').webFrame;
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
|
||||||
|
@ -49,7 +48,6 @@ exports.load = function (modulePaths, resultCallback, options) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Error handler
|
// Error handler
|
||||||
// @ts-ignore
|
|
||||||
process.on('uncaughtException', function (error) {
|
process.on('uncaughtException', function (error) {
|
||||||
onUnexpectedError(error, enableDeveloperTools);
|
onUnexpectedError(error, enableDeveloperTools);
|
||||||
});
|
});
|
||||||
|
@ -164,7 +162,6 @@ function parseURLQueryArgs() {
|
||||||
*/
|
*/
|
||||||
function registerDeveloperKeybindings(disallowReloadKeybinding) {
|
function registerDeveloperKeybindings(disallowReloadKeybinding) {
|
||||||
|
|
||||||
// @ts-ignore
|
|
||||||
const ipc = require('electron').ipcRenderer;
|
const ipc = require('electron').ipcRenderer;
|
||||||
|
|
||||||
const extractKey = function (e) {
|
const extractKey = function (e) {
|
||||||
|
@ -203,7 +200,6 @@ function registerDeveloperKeybindings(disallowReloadKeybinding) {
|
||||||
|
|
||||||
function onUnexpectedError(error, enableDeveloperTools) {
|
function onUnexpectedError(error, enableDeveloperTools) {
|
||||||
|
|
||||||
// @ts-ignore
|
|
||||||
const ipc = require('electron').ipcRenderer;
|
const ipc = require('electron').ipcRenderer;
|
||||||
|
|
||||||
if (enableDeveloperTools) {
|
if (enableDeveloperTools) {
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
//@ts-check
|
//@ts-check
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-expect-error
|
||||||
const pkg = require('../package.json');
|
const pkg = require('../package.json');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const os = require('os');
|
const os = require('os');
|
||||||
|
|
|
@ -401,9 +401,9 @@ suite('Paths (Node Implementation)', () => {
|
||||||
];
|
];
|
||||||
resolveTests.forEach((test) => {
|
resolveTests.forEach((test) => {
|
||||||
const resolve = test[0];
|
const resolve = test[0];
|
||||||
//@ts-ignore
|
//@ts-expect-error
|
||||||
test[1].forEach((test) => {
|
test[1].forEach((test) => {
|
||||||
//@ts-ignore
|
//@ts-expect-error
|
||||||
const actual = resolve.apply(null, test[0]);
|
const actual = resolve.apply(null, test[0]);
|
||||||
let actualAlt;
|
let actualAlt;
|
||||||
const os = resolve === path.win32.resolve ? 'win32' : 'posix';
|
const os = resolve === path.win32.resolve ? 'win32' : 'posix';
|
||||||
|
@ -579,9 +579,9 @@ suite('Paths (Node Implementation)', () => {
|
||||||
];
|
];
|
||||||
relativeTests.forEach((test) => {
|
relativeTests.forEach((test) => {
|
||||||
const relative = test[0];
|
const relative = test[0];
|
||||||
//@ts-ignore
|
//@ts-expect-error
|
||||||
test[1].forEach((test) => {
|
test[1].forEach((test) => {
|
||||||
//@ts-ignore
|
//@ts-expect-error
|
||||||
const actual = relative(test[0], test[1]);
|
const actual = relative(test[0], test[1]);
|
||||||
const expected = test[2];
|
const expected = test[2];
|
||||||
const os = relative === path.win32.relative ? 'win32' : 'posix';
|
const os = relative === path.win32.relative ? 'win32' : 'posix';
|
||||||
|
|
|
@ -107,7 +107,7 @@ function parseTest(fileName: string): ITest {
|
||||||
return { content, assertions };
|
return { content, assertions };
|
||||||
}
|
}
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-expect-error
|
||||||
function executeTest(fileName: string, parseFunc: IParseFunc): void {
|
function executeTest(fileName: string, parseFunc: IParseFunc): void {
|
||||||
const { content, assertions } = parseTest(fileName);
|
const { content, assertions } = parseTest(fileName);
|
||||||
const actual = parseFunc(content);
|
const actual = parseFunc(content);
|
||||||
|
|
|
@ -54,7 +54,7 @@ export class BrowserClipboardService implements IClipboardService {
|
||||||
}
|
}
|
||||||
|
|
||||||
readFindText(): string {
|
readFindText(): string {
|
||||||
// @ts-ignore
|
// @ts-expect-error
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,12 +20,10 @@ import { assertIsDefined } from 'vs/base/common/types';
|
||||||
import { Schemas } from 'vs/base/common/network';
|
import { Schemas } from 'vs/base/common/network';
|
||||||
|
|
||||||
function es5ClassCompat(target: Function): any {
|
function es5ClassCompat(target: Function): any {
|
||||||
///@ts-ignore
|
///@ts-expect-error
|
||||||
function _() { return Reflect.construct(target, arguments, this.constructor); }
|
function _() { return Reflect.construct(target, arguments, this.constructor); }
|
||||||
Object.defineProperty(_, 'name', Object.getOwnPropertyDescriptor(target, 'name')!);
|
Object.defineProperty(_, 'name', Object.getOwnPropertyDescriptor(target, 'name')!);
|
||||||
///@ts-ignore
|
|
||||||
Object.setPrototypeOf(_, target);
|
Object.setPrototypeOf(_, target);
|
||||||
///@ts-ignore
|
|
||||||
Object.setPrototypeOf(_.prototype, target.prototype);
|
Object.setPrototypeOf(_.prototype, target.prototype);
|
||||||
return _;
|
return _;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,6 @@ export interface IRPCProtocol {
|
||||||
assertRegistered(identifiers: ProxyIdentifier<any>[]): void;
|
assertRegistered(identifiers: ProxyIdentifier<any>[]): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
// @ts-ignore
|
|
||||||
export class ProxyIdentifier<T> {
|
export class ProxyIdentifier<T> {
|
||||||
public static count = 0;
|
public static count = 0;
|
||||||
_proxyIdentifierBrand: void;
|
_proxyIdentifierBrand: void;
|
||||||
|
|
|
@ -155,7 +155,7 @@ async function runTestsInBrowser(testModules, browserType) {
|
||||||
});
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// @ts-ignore
|
// @ts-expect-error
|
||||||
await page.evaluate(modules => loadAndRun(modules), testModules);
|
await page.evaluate(modules => loadAndRun(modules), testModules);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
|
|
Loading…
Reference in a new issue