Remove typings and replace missing methods with vscodes (#8217)

* remove typings and replace missing methods with vscodes

* fix strict-null-checks

* fix tests
This commit is contained in:
Anthony Dresser
2019-11-05 13:03:20 -08:00
committed by GitHub
parent 4645a8ba6b
commit 22a427f934
184 changed files with 634 additions and 43388 deletions

View File

@@ -19,6 +19,8 @@ import { URI } from 'vs/base/common/uri';
import * as nls from 'vs/nls';
import { EventType, addDisposableListener } from 'vs/base/browser/dom';
import { IKeyboardEvent, StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
import { endsWith } from 'vs/base/common/strings';
import { firstIndex } from 'vs/base/common/arrays';
export type IUserFriendlyIcon = string | URI | { light: string | URI; dark: string | URI };
@@ -192,9 +194,9 @@ export abstract class ComponentBase extends Disposable implements IComponent, On
public convertSizeToNumber(size: number | string): number {
if (size && typeof (size) === 'string') {
if (size.toLowerCase().endsWith('px')) {
if (endsWith(size.toLowerCase(), 'px')) {
return +size.replace('px', '');
} else if (size.toLowerCase().endsWith('em')) {
} else if (endsWith(size.toLowerCase(), 'em')) {
return +size.replace('em', '') * 11;
}
} else if (!size) {
@@ -217,7 +219,7 @@ export abstract class ComponentBase extends Disposable implements IComponent, On
return defaultValue;
}
let convertedSize: string = size ? size.toString() : defaultValue;
if (!convertedSize.toLowerCase().endsWith('px') && !convertedSize.toLowerCase().endsWith('%')) {
if (!endsWith(convertedSize.toLowerCase(), 'px') && !endsWith(convertedSize.toLowerCase(), '%')) {
convertedSize = convertedSize + 'px';
}
return convertedSize;
@@ -308,7 +310,7 @@ export abstract class ContainerBase<T> extends ComponentBase {
if (!componentDescriptor) {
return false;
}
let index = this.items.findIndex(item => item.descriptor.id === componentDescriptor.id && item.descriptor.type === componentDescriptor.type);
let index = firstIndex(this.items, item => item.descriptor.id === componentDescriptor.id && item.descriptor.type === componentDescriptor.type);
if (index >= 0) {
this.items.splice(index, 1);
this._changeRef.detectChanges();