Opt a few more files into strict null checks

This commit is contained in:
Matt Bierner 2018-10-10 15:14:28 -07:00
parent 242c63854d
commit c1d0930765
3 changed files with 14 additions and 11 deletions

View file

@ -6,7 +6,10 @@
},
"include": [
"./typings",
"./vs/base/common/iterator.ts"
"./vs/base/common/charCode.ts",
"./vs/base/common/iterator.ts",
"./vs/base/common/platform.ts",
"./vs/base/common/uri.ts"
],
"exclude": [
"./typings/require-monaco.d.ts"

View file

@ -8,9 +8,9 @@ let _isMacintosh = false;
let _isLinux = false;
let _isNative = false;
let _isWeb = false;
let _locale: string = undefined;
let _language: string = undefined;
let _translationsConfigFile: string = undefined;
let _locale: string | undefined = undefined;
let _language: string | undefined = undefined;
let _translationsConfigFile: string | undefined = undefined;
interface NLSConfig {
locale: string;
@ -129,7 +129,7 @@ export const translationsConfigFile = _translationsConfigFile;
const _globals = (typeof self === 'object' ? self : typeof global === 'object' ? global : {} as any);
export const globals: any = _globals;
let _setImmediate: (callback: (...args: any[]) => void) => number = null;
let _setImmediate: ((callback: (...args: any[]) => void) => number) | null = null;
export function setImmediate(callback: (...args: any[]) => void): number {
if (_setImmediate === null) {
if (globals.setImmediate) {
@ -140,7 +140,7 @@ export function setImmediate(callback: (...args: any[]) => void): number {
_setImmediate = globals.setTimeout.bind(globals);
}
}
return _setImmediate(callback);
return _setImmediate!(callback);
}
export const enum OperatingSystem {

View file

@ -141,7 +141,7 @@ export class URI implements UriComponents {
/**
* @internal
*/
protected constructor(scheme: string, authority: string, path: string, query: string, fragment: string);
protected constructor(scheme: string, authority?: string, path?: string, query?: string, fragment?: string);
/**
* @internal
@ -386,8 +386,8 @@ interface UriState extends UriComponents {
// tslint:disable-next-line:class-name
class _URI extends URI {
_formatted: string = null;
_fsPath: string = null;
_formatted: string | null = null;
_fsPath: string | null = null;
get fsPath(): string {
if (!this._fsPath) {
@ -465,7 +465,7 @@ const encodeTable: { [ch: number]: string } = {
};
function encodeURIComponentFast(uriComponent: string, allowSlash: boolean, firstPos: number = 0): string {
let res: string = undefined;
let res: string | undefined = undefined;
let nativeEncodePos = -1;
for (let pos = firstPos; pos < uriComponent.length; pos++) {
@ -526,7 +526,7 @@ function encodeURIComponentFast(uriComponent: string, allowSlash: boolean, first
}
function encodeURIComponentMinimal(path: string): string {
let res: string = undefined;
let res: string | undefined = undefined;
for (let pos = 0; pos < path.length; pos++) {
let code = path.charCodeAt(pos);
if (code === CharCode.Hash || code === CharCode.QuestionMark) {