mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 04:49:35 +00:00
Switch to use standard @types/node types instead of our customized version
Using a custom version of the node typings is causing a lot of pain while trying to upgrade our build to use `@types` instead of the `d.ts` files we have to maintain. I believe we primarily maintain our own version for two reason: - Custom require function - setTimeout and other timer functions return NodeJs.timer instead of a number These can both be delt with, the first by using interface augmentation and the second by switching to use any types for timer. I believe that the pain of maintaining our own node `d.ts` outweighs the benefits here This change switches us to use the standard @types/node package for our node typings
This commit is contained in:
parent
63e3162bc9
commit
f7456ebf90
|
@ -65,7 +65,6 @@ function createCompile(src, build, emitError) {
|
|||
var typesDts = [
|
||||
'node_modules/typescript/lib/*.d.ts',
|
||||
'node_modules/@types/**/*.d.ts',
|
||||
'!node_modules/@types/node/**/*',
|
||||
'!node_modules/@types/webpack/**/*',
|
||||
'!node_modules/@types/uglify-js/**/*',
|
||||
];
|
||||
|
|
|
@ -75,7 +75,6 @@ function createCompile(src: string, build: boolean, emitError?: boolean): (token
|
|||
const typesDts = [
|
||||
'node_modules/typescript/lib/*.d.ts',
|
||||
'node_modules/@types/**/*.d.ts',
|
||||
'!node_modules/@types/node/**/*',
|
||||
'!node_modules/@types/webpack/**/*',
|
||||
'!node_modules/@types/uglify-js/**/*',
|
||||
];
|
||||
|
|
|
@ -59,6 +59,7 @@
|
|||
"@types/keytar": "^4.0.1",
|
||||
"@types/minimist": "^1.2.0",
|
||||
"@types/mocha": "2.2.39",
|
||||
"@types/node": "^8.9.1",
|
||||
"@types/semver": "^5.5.0",
|
||||
"@types/sinon": "^1.16.36",
|
||||
"@types/webpack": "^4.4.10",
|
||||
|
@ -148,4 +149,4 @@
|
|||
"windows-mutex": "^0.2.0",
|
||||
"windows-process-tree": "0.2.2"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
2
src/typings/electron.d.ts
vendored
2
src/typings/electron.d.ts
vendored
|
@ -3,7 +3,7 @@
|
|||
// Definitions by: The Electron Team <https://github.com/electron/electron>
|
||||
// Definitions: https://github.com/electron/electron-typescript-definitions
|
||||
|
||||
/// <reference path="./node.d.ts" />
|
||||
/// <reference types="node" />
|
||||
|
||||
type GlobalEvent = Event;
|
||||
|
||||
|
|
2
src/typings/iconv-lite.d.ts
vendored
2
src/typings/iconv-lite.d.ts
vendored
|
@ -3,7 +3,7 @@
|
|||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
/// <reference path='./node.d.ts'/>
|
||||
/// <reference types='node'/>
|
||||
|
||||
declare module 'iconv-lite' {
|
||||
export function decode(buffer: Buffer, encoding: string): string;
|
||||
|
|
7239
src/typings/node.d.ts
vendored
7239
src/typings/node.d.ts
vendored
File diff suppressed because it is too large
Load diff
5
src/typings/require.d.ts
vendored
5
src/typings/require.d.ts
vendored
|
@ -35,12 +35,11 @@ declare var define: {
|
|||
(dependencies: string[], definition: any): any;
|
||||
};
|
||||
|
||||
declare var require: {
|
||||
interface NodeRequire {
|
||||
toUrl(path: string): string;
|
||||
(moduleName: string): any;
|
||||
(dependencies: string[], callback: (...args: any[]) => any, errorback?: (err: any) => void): any;
|
||||
config(data: any): any;
|
||||
onError: Function;
|
||||
__$__nodeRequire<T>(moduleName: string): T;
|
||||
getStats(): ReadonlyArray<LoaderEvent>
|
||||
};
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ import { addDisposableListener } from 'vs/base/browser/dom';
|
|||
* dragover event for 800ms. If the drag is aborted before, the callback will not be triggered.
|
||||
*/
|
||||
export class DelayedDragHandler extends Disposable {
|
||||
private timeout: number;
|
||||
private timeout: any;
|
||||
|
||||
constructor(container: HTMLElement, callback: () => void) {
|
||||
super();
|
||||
|
|
|
@ -275,7 +275,7 @@ interface IRequestAnimationFrame {
|
|||
let _animationFrame: IRequestAnimationFrame = null;
|
||||
function doRequestAnimationFrame(callback: (time: number) => void): number {
|
||||
if (!_animationFrame) {
|
||||
const emulatedRequestAnimationFrame = (callback: (time: number) => void): number => {
|
||||
const emulatedRequestAnimationFrame = (callback: (time: number) => void): any => {
|
||||
return setTimeout(() => callback(new Date().getTime()), 0);
|
||||
};
|
||||
_animationFrame = (
|
||||
|
|
|
@ -174,7 +174,7 @@ export class SimpleThrottler {
|
|||
*/
|
||||
export class Delayer<T> {
|
||||
|
||||
private timeout: number;
|
||||
private timeout: any;
|
||||
private completionPromise: TPromise;
|
||||
private doResolve: ValueCallback;
|
||||
private doReject: (err: any) => void;
|
||||
|
@ -491,7 +491,7 @@ export class ResourceQueue {
|
|||
}
|
||||
|
||||
export class TimeoutTimer extends Disposable {
|
||||
private _token: number;
|
||||
private _token: any;
|
||||
|
||||
constructor();
|
||||
constructor(runner: () => void, timeout: number);
|
||||
|
@ -538,7 +538,7 @@ export class TimeoutTimer extends Disposable {
|
|||
|
||||
export class IntervalTimer extends Disposable {
|
||||
|
||||
private _token: number;
|
||||
private _token: any;
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
|
@ -569,7 +569,7 @@ export class RunOnceScheduler {
|
|||
|
||||
protected runner: (...args: any[]) => void;
|
||||
|
||||
private timeoutToken: number;
|
||||
private timeoutToken: any;
|
||||
private timeout: number;
|
||||
private timeoutHandler: () => void;
|
||||
|
||||
|
|
|
@ -116,7 +116,7 @@ export class QuickOpenWidget extends Disposable implements IModelProvider {
|
|||
private inputElement: HTMLElement;
|
||||
private layoutDimensions: DOM.Dimension;
|
||||
private model: IModel<any>;
|
||||
private inputChangingTimeoutHandle: number;
|
||||
private inputChangingTimeoutHandle: any;
|
||||
private styles: IQuickOpenStyles;
|
||||
private renderer: Renderer;
|
||||
|
||||
|
|
|
@ -127,7 +127,7 @@ export class ViewItem implements IViewItem {
|
|||
public needsRender: boolean;
|
||||
public uri: string;
|
||||
public unbindDragStart: Lifecycle.IDisposable;
|
||||
public loadingTimer: number;
|
||||
public loadingTimer: any;
|
||||
|
||||
public _styles: any;
|
||||
private _draggable: boolean;
|
||||
|
|
|
@ -166,7 +166,7 @@ export class CodeApplication {
|
|||
});
|
||||
|
||||
let macOpenFileURIs: URI[] = [];
|
||||
let runningTimeout: number = null;
|
||||
let runningTimeout: any = null;
|
||||
app.on('open-file', (event: Event, path: string) => {
|
||||
this.logService.trace('App#open-file: ', path);
|
||||
event.preventDefault();
|
||||
|
|
|
@ -185,7 +185,7 @@ function setupIPC(accessor: ServicesAccessor): Thenable<Server> {
|
|||
// Show a warning dialog after some timeout if it takes long to talk to the other instance
|
||||
// Skip this if we are running with --wait where it is expected that we wait for a while.
|
||||
// Also skip when gathering diagnostics (--status) which can take a longer time.
|
||||
let startupWarningDialogHandle: number;
|
||||
let startupWarningDialogHandle: any;
|
||||
if (!environmentService.wait && !environmentService.status && !environmentService.args['upload-logs']) {
|
||||
startupWarningDialogHandle = setTimeout(() => {
|
||||
showStartupWarningDialog(
|
||||
|
|
|
@ -99,7 +99,7 @@ class CSSBasedConfiguration extends Disposable {
|
|||
public static readonly INSTANCE = new CSSBasedConfiguration();
|
||||
|
||||
private _cache: CSSBasedConfigurationCache;
|
||||
private _evictUntrustedReadingsTimeout: number;
|
||||
private _evictUntrustedReadingsTimeout: any;
|
||||
|
||||
private _onDidChange = this._register(new Emitter<void>());
|
||||
public readonly onDidChange: Event<void> = this._onDidChange.event;
|
||||
|
|
|
@ -9,7 +9,7 @@ import { IDimension } from 'vs/editor/common/editorCommon';
|
|||
export class ElementSizeObserver extends Disposable {
|
||||
|
||||
private referenceDomElement: HTMLElement;
|
||||
private measureReferenceDomElementToken: number;
|
||||
private measureReferenceDomElementToken: any;
|
||||
private changeCallback: () => void;
|
||||
private width: number;
|
||||
private height: number;
|
||||
|
|
|
@ -263,7 +263,7 @@ export class TextModel extends Disposable implements model.ITextModel {
|
|||
private _languageIdentifier: LanguageIdentifier;
|
||||
private _tokenizationListener: IDisposable;
|
||||
private _languageRegistryListener: IDisposable;
|
||||
private _revalidateTokensTimeout: number;
|
||||
private _revalidateTokensTimeout: any;
|
||||
/*private*/_tokens: ModelLinesTokens;
|
||||
//#endregion
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ export class InitializingRangeProvider implements RangeProvider {
|
|||
readonly id = ID_INIT_PROVIDER;
|
||||
|
||||
private decorationIds: string[] | undefined;
|
||||
private timeout: number;
|
||||
private timeout: any;
|
||||
|
||||
constructor(private editorModel: ITextModel, initialRanges: ILineRange[], onTimeout: () => void, timeoutTime: number) {
|
||||
if (initialRanges.length) {
|
||||
|
|
|
@ -128,7 +128,7 @@ class MessageWidget implements IContentWidget {
|
|||
private _domNode: HTMLDivElement;
|
||||
|
||||
static fadeOut(messageWidget: MessageWidget): IDisposable {
|
||||
let handle: number;
|
||||
let handle: any;
|
||||
const dispose = () => {
|
||||
messageWidget.dispose();
|
||||
clearTimeout(handle);
|
||||
|
|
|
@ -363,7 +363,7 @@ export class SuggestWidget implements IContentWidget, IVirtualDelegate<ICompleti
|
|||
|
||||
private state: State;
|
||||
private isAuto: boolean;
|
||||
private loadingTimeout: number;
|
||||
private loadingTimeout: any;
|
||||
private currentSuggestionDetails: CancelablePromise<void>;
|
||||
private focusedItem: ICompletionItem;
|
||||
private ignoreFocusEvents = false;
|
||||
|
|
|
@ -173,7 +173,7 @@ class WordHighlighter {
|
|||
private workerRequestValue: DocumentHighlight[] = [];
|
||||
|
||||
private lastCursorPositionChangeTime: number = 0;
|
||||
private renderDecorationsTimer: number = -1;
|
||||
private renderDecorationsTimer: any = -1;
|
||||
|
||||
private _hasWordHighlights: IContextKey<boolean>;
|
||||
private _ignorePositionChangeEvent: boolean;
|
||||
|
|
|
@ -77,7 +77,7 @@ export class LongRunningOperation {
|
|||
private currentOperationId = 0;
|
||||
private currentOperationDisposables: IDisposable[] = [];
|
||||
private currentProgressRunner: IProgressRunner;
|
||||
private currentProgressTimeout: number;
|
||||
private currentProgressTimeout: any;
|
||||
|
||||
constructor(
|
||||
private progressService: IProgressService
|
||||
|
|
|
@ -53,7 +53,7 @@ export default class ErrorTelemetry {
|
|||
|
||||
private _telemetryService: ITelemetryService;
|
||||
private _flushDelay: number;
|
||||
private _flushHandle = -1;
|
||||
private _flushHandle: any = -1;
|
||||
private _buffer: ErrorEvent[] = [];
|
||||
private _disposables: IDisposable[] = [];
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ class DecorationRequestsQueue {
|
|||
private _requests: { [id: number]: DecorationRequest } = Object.create(null);
|
||||
private _resolver: { [id: number]: (data: DecorationData) => any } = Object.create(null);
|
||||
|
||||
private _timer: number;
|
||||
private _timer: any;
|
||||
|
||||
constructor(
|
||||
private _proxy: ExtHostDecorationsShape
|
||||
|
|
|
@ -36,7 +36,7 @@ export class BoundModelReferenceCollection {
|
|||
|
||||
add(ref: IReference<ITextEditorModel>): void {
|
||||
let length = ref.object.textEditorModel.getValueLength();
|
||||
let handle: number;
|
||||
let handle: any;
|
||||
let entry: { length: number, dispose(): void };
|
||||
const dispose = () => {
|
||||
let idx = this._data.indexOf(entry);
|
||||
|
|
|
@ -35,7 +35,7 @@ export class HeapService implements IHeapService {
|
|||
|
||||
private _activeSignals = new WeakMap<any, object>();
|
||||
private _activeIds = new Set<number>();
|
||||
private _consumeHandle: number;
|
||||
private _consumeHandle: any;
|
||||
|
||||
constructor() {
|
||||
//
|
||||
|
|
|
@ -242,7 +242,7 @@ class ExtHostQuickInput implements QuickInput {
|
|||
private _onDidChangeValueEmitter = new Emitter<string>();
|
||||
private _onDidTriggerButtonEmitter = new Emitter<QuickInputButton>();
|
||||
private _onDidHideEmitter = new Emitter<void>();
|
||||
private _updateTimeout: number;
|
||||
private _updateTimeout: any;
|
||||
private _pendingUpdate: TransferQuickInput = { id: this._id };
|
||||
|
||||
private _disposed = false;
|
||||
|
|
|
@ -208,7 +208,7 @@ class BatchedCollector<T> {
|
|||
private totalNumberCompleted = 0;
|
||||
private batch: T[] = [];
|
||||
private batchSize = 0;
|
||||
private timeoutHandle: number;
|
||||
private timeoutHandle: any;
|
||||
|
||||
constructor(private maxBatchSize: number, private cb: (items: T[]) => void) {
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ export class ExtHostStatusBarEntry implements StatusBarItem {
|
|||
private _color: string | ThemeColor;
|
||||
private _command: string;
|
||||
|
||||
private _timeoutHandle: number;
|
||||
private _timeoutHandle: any;
|
||||
private _proxy: MainThreadStatusBarShape;
|
||||
|
||||
private _extensionId: string;
|
||||
|
@ -173,7 +173,7 @@ export class ExtHostStatusBar {
|
|||
setStatusBarMessage(text: string, timeoutOrThenable?: number | Thenable<any>): Disposable {
|
||||
|
||||
let d = this._statusMessage.setMessage(text);
|
||||
let handle: number;
|
||||
let handle: any;
|
||||
|
||||
if (typeof timeoutOrThenable === 'number') {
|
||||
handle = setTimeout(() => d.dispose(), timeoutOrThenable);
|
||||
|
|
|
@ -134,7 +134,7 @@ export class ActivityActionItem extends BaseActionItem {
|
|||
|
||||
private badgeContent: HTMLElement;
|
||||
private badgeDisposable: IDisposable = Disposable.None;
|
||||
private mouseUpTimeout: number;
|
||||
private mouseUpTimeout: any;
|
||||
|
||||
constructor(
|
||||
action: ActivityAction,
|
||||
|
|
|
@ -240,7 +240,7 @@ class ZoomStatusbarItem extends Themable implements IStatusbarItem {
|
|||
|
||||
static instance: ZoomStatusbarItem;
|
||||
|
||||
showTimeout: number;
|
||||
showTimeout: any;
|
||||
|
||||
private statusBarItem: HTMLElement;
|
||||
private onSelectScale?: (scale: Scale) => void;
|
||||
|
|
|
@ -186,7 +186,7 @@ export class NotificationsToasts extends Themable {
|
|||
itemDisposeables.push(addDisposableListener(notificationToastContainer, EventType.MOUSE_OUT, () => isMouseOverToast = false));
|
||||
|
||||
// Install Timers
|
||||
let timeoutHandle: number;
|
||||
let timeoutHandle: any;
|
||||
const hideAfterTimeout = () => {
|
||||
timeoutHandle = setTimeout(() => {
|
||||
const showsProgress = item.hasProgress() && !item.progress.state.done;
|
||||
|
|
|
@ -194,7 +194,7 @@ export class StatusbarPart extends Part implements IStatusbarService {
|
|||
statusDispose = this.addEntry({ text: message }, StatusbarAlignment.LEFT, -Number.MAX_VALUE /* far right on left hand side */);
|
||||
showHandle = null;
|
||||
}, delayBy);
|
||||
let hideHandle: number;
|
||||
let hideHandle: any;
|
||||
|
||||
// Dispose function takes care of timeouts and actual entry
|
||||
const dispose = {
|
||||
|
|
|
@ -81,7 +81,7 @@ export class Repl extends Panel implements IPrivateReplService, IHistoryNavigati
|
|||
private treeContainer: HTMLElement;
|
||||
private replInput: CodeEditorWidget;
|
||||
private replInputContainer: HTMLElement;
|
||||
private refreshTimeoutHandle: number;
|
||||
private refreshTimeoutHandle: any;
|
||||
private actions: IAction[];
|
||||
private dimension: dom.Dimension;
|
||||
private replInputHeight: number;
|
||||
|
|
|
@ -137,7 +137,7 @@ export class ProfileExtHostStatusbarItem implements IStatusbarItem {
|
|||
private statusBarItem: HTMLElement;
|
||||
private label: HTMLElement;
|
||||
private timeStarted: number;
|
||||
private labelUpdater: number;
|
||||
private labelUpdater: any;
|
||||
private clickHandler: () => void;
|
||||
|
||||
constructor() {
|
||||
|
|
|
@ -126,7 +126,7 @@ class RequestOracle {
|
|||
this._lastState = thisState;
|
||||
this._callback(codeEditor, undefined);
|
||||
|
||||
let handle: number;
|
||||
let handle: any;
|
||||
let contentListener = codeEditor.onDidChangeModelContent(event => {
|
||||
clearTimeout(handle);
|
||||
handle = setTimeout(() => this._callback(codeEditor, event), 350);
|
||||
|
|
|
@ -1283,7 +1283,7 @@ export class SearchView extends Viewlet implements IViewlet, IPanel {
|
|||
};
|
||||
|
||||
// Handle UI updates in an interval to show frequent progress and results
|
||||
let uiRefreshHandle = setInterval(() => {
|
||||
let uiRefreshHandle: any = setInterval(() => {
|
||||
if (!this.searching) {
|
||||
window.clearInterval(uiRefreshHandle);
|
||||
return;
|
||||
|
|
|
@ -66,7 +66,7 @@ class MessageWidget {
|
|||
public get domNode(): HTMLElement { return this._domNode; }
|
||||
|
||||
public static fadeOut(messageWidget: MessageWidget): IDisposable {
|
||||
let handle: number;
|
||||
let handle: any;
|
||||
const dispose = () => {
|
||||
messageWidget.dispose();
|
||||
clearTimeout(handle);
|
||||
|
|
|
@ -14,7 +14,7 @@ import { IShellLaunchConfig } from 'vs/workbench/parts/terminal/common/terminal'
|
|||
|
||||
export class TerminalProcess implements ITerminalChildProcess, IDisposable {
|
||||
private _exitCode: number;
|
||||
private _closeTimeout: number;
|
||||
private _closeTimeout: any;
|
||||
private _ptyProcess: pty.IPty;
|
||||
private _currentTitle: string = '';
|
||||
|
||||
|
|
|
@ -262,7 +262,7 @@ export class ExtensionHostProcessWorker implements IExtensionHostStarter {
|
|||
this._inspectPort = portData.actual;
|
||||
|
||||
// Help in case we fail to start it
|
||||
let startupTimeoutHandle: number;
|
||||
let startupTimeoutHandle: any;
|
||||
if (!this._environmentService.isBuilt || this._isExtensionDevHost) {
|
||||
startupTimeoutHandle = setTimeout(() => {
|
||||
const msg = this._isExtensionDevDebugBrk
|
||||
|
|
|
@ -903,7 +903,7 @@ export class FileService extends Disposable implements IFileService {
|
|||
private doMoveItemToTrash(resource: uri): TPromise<void> {
|
||||
const absolutePath = resource.fsPath;
|
||||
|
||||
const shell = (require('electron') as Electron.RendererInterface).shell; // workaround for being able to run tests out of VSCode debugger
|
||||
const shell = (require('electron') as any as Electron.RendererInterface).shell; // workaround for being able to run tests out of VSCode debugger
|
||||
const result = shell.moveItemToTrash(absolutePath);
|
||||
if (!result) {
|
||||
return TPromise.wrapError(new Error(isWindows ? nls.localize('binFailed', "Failed to move '{0}' to the recycle bin", paths.basename(absolutePath)) : nls.localize('trashFailed', "Failed to move '{0}' to the trash", paths.basename(absolutePath))));
|
||||
|
|
|
@ -502,7 +502,7 @@ class BatchedCollector<T> {
|
|||
private totalNumberCompleted = 0;
|
||||
private batch: T[] = [];
|
||||
private batchSize = 0;
|
||||
private timeoutHandle: number;
|
||||
private timeoutHandle: any;
|
||||
|
||||
constructor(private maxBatchSize: number, private cb: (items: T | T[]) => void) {
|
||||
}
|
||||
|
|
|
@ -42,6 +42,11 @@
|
|||
resolved "https://registry.yarnpkg.com/@types/node/-/node-4.2.22.tgz#cf488a0f6b4a9c245d09927f4f757ca278b9c8ce"
|
||||
integrity sha512-LXRap3bb4AjtLZ5NOFc4ssVZrQPTgdPcNm++0SEJuJZaOA+xHkojJNYqy33A5q/94BmG5tA6yaMeD4VdCv5aSA==
|
||||
|
||||
"@types/node@^8.9.1":
|
||||
version "8.10.34"
|
||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-8.10.34.tgz#a94d9f3767fe45f211e09e49af598bb84822280c"
|
||||
integrity sha512-alypNiaAEd0RBGXoWehJ2gchPYCITmw4CYBoB5nDlji8l8on7FsklfdfIs4DDmgpKLSX3OF3ha6SV+0W7cTzUA==
|
||||
|
||||
"@types/semver@^5.4.0", "@types/semver@^5.5.0":
|
||||
version "5.5.0"
|
||||
resolved "https://registry.yarnpkg.com/@types/semver/-/semver-5.5.0.tgz#146c2a29ee7d3bae4bf2fcb274636e264c813c45"
|
||||
|
|
Loading…
Reference in a new issue