mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
Reenable strict null checks (#6716)
* add some patches for strict null * renable strict null checks
This commit is contained in:
14
.vscode/tasks.json
vendored
14
.vscode/tasks.json
vendored
@@ -42,6 +42,20 @@
|
|||||||
"applyTo": "allDocuments"
|
"applyTo": "allDocuments"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "npm",
|
||||||
|
"script": "strict-null-check-watch",
|
||||||
|
"label": "TS - Strict Null Cheks",
|
||||||
|
"isBackground": true,
|
||||||
|
"presentation": {
|
||||||
|
"reveal": "never"
|
||||||
|
},
|
||||||
|
"problemMatcher": {
|
||||||
|
"base": "$tsc-watch",
|
||||||
|
"owner": "typescript-strict-null-checks",
|
||||||
|
"applyTo": "allDocuments"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "gulp",
|
"type": "gulp",
|
||||||
"task": "tslint",
|
"task": "tslint",
|
||||||
|
|||||||
@@ -35,9 +35,9 @@ steps:
|
|||||||
yarn tslint
|
yarn tslint
|
||||||
displayName: 'Run TSLint'
|
displayName: 'Run TSLint'
|
||||||
|
|
||||||
# - script: |
|
- script: |
|
||||||
# yarn strict-null-check
|
yarn strict-null-check
|
||||||
# displayName: 'Run Strict Null Check'
|
displayName: 'Run Strict Null Check'
|
||||||
|
|
||||||
- script: |
|
- script: |
|
||||||
yarn compile
|
yarn compile
|
||||||
|
|||||||
@@ -20,9 +20,9 @@ steps:
|
|||||||
yarn tslint
|
yarn tslint
|
||||||
displayName: 'Run TSLint'
|
displayName: 'Run TSLint'
|
||||||
|
|
||||||
# - script: |
|
- script: |
|
||||||
# yarn strict-null-check
|
yarn strict-null-check
|
||||||
# displayName: 'Run Strict Null Check'
|
displayName: 'Run Strict Null Check'
|
||||||
|
|
||||||
- script: |
|
- script: |
|
||||||
yarn compile
|
yarn compile
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ export class DBCellValue {
|
|||||||
/**
|
/**
|
||||||
* Format xml field into a hyperlink and performs HTML entity encoding
|
* Format xml field into a hyperlink and performs HTML entity encoding
|
||||||
*/
|
*/
|
||||||
export function hyperLinkFormatter(row: number, cell: any, value: any, columnDef: any, dataContext: any): string {
|
export function hyperLinkFormatter(row: number | undefined, cell: any | undefined, value: any, columnDef: any | undefined, dataContext: any | undefined): string {
|
||||||
let cellClasses = 'grid-cell-value-container';
|
let cellClasses = 'grid-cell-value-container';
|
||||||
let valueToDisplay: string = '';
|
let valueToDisplay: string = '';
|
||||||
|
|
||||||
@@ -38,7 +38,7 @@ export function hyperLinkFormatter(row: number, cell: any, value: any, columnDef
|
|||||||
/**
|
/**
|
||||||
* Format all text to replace all new lines with spaces and performs HTML entity encoding
|
* Format all text to replace all new lines with spaces and performs HTML entity encoding
|
||||||
*/
|
*/
|
||||||
export function textFormatter(row: number, cell: any, value: any, columnDef: any, dataContext: any): string {
|
export function textFormatter(row: number | undefined, cell: any | undefined, value: any, columnDef: any | undefined, dataContext: any | undefined): string {
|
||||||
let cellClasses = 'grid-cell-value-container';
|
let cellClasses = 'grid-cell-value-container';
|
||||||
let valueToDisplay = '';
|
let valueToDisplay = '';
|
||||||
let titleValue = '';
|
let titleValue = '';
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ suite('SQL Telemetry Utilities tests', () => {
|
|||||||
serverName: '',
|
serverName: '',
|
||||||
authenticationType: '',
|
authenticationType: '',
|
||||||
getOptionsKey: () => '',
|
getOptionsKey: () => '',
|
||||||
matches: undefined,
|
matches: () => false,
|
||||||
groupFullName: '',
|
groupFullName: '',
|
||||||
groupId: '',
|
groupId: '',
|
||||||
id: '',
|
id: '',
|
||||||
@@ -44,7 +44,7 @@ suite('SQL Telemetry Utilities tests', () => {
|
|||||||
};
|
};
|
||||||
const logService = new NullLogService();
|
const logService = new NullLogService();
|
||||||
TelemetryUtils.addTelemetry(telemetryService.object, logService, telemetryKey, data, connectionProfile).then(() => {
|
TelemetryUtils.addTelemetry(telemetryService.object, logService, telemetryKey, data, connectionProfile).then(() => {
|
||||||
telemetryService.verify(x => x.publicLog(TypeMoq.It.is(a => a === telemetryKey), TypeMoq.It.is(b => b.provider === providerName)), TypeMoq.Times.once());
|
telemetryService.verify(x => x.publicLog(TypeMoq.It.is(a => a === telemetryKey), TypeMoq.It.is(b => b!.provider === providerName)), TypeMoq.Times.once());
|
||||||
done();
|
done();
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
assert.fail(err);
|
assert.fail(err);
|
||||||
@@ -63,11 +63,11 @@ suite('SQL Telemetry Utilities tests', () => {
|
|||||||
TelemetryUtils.addTelemetry(telemetryService.object, logService, telemetryKey, data, connectionProfile).then(() => {
|
TelemetryUtils.addTelemetry(telemetryService.object, logService, telemetryKey, data, connectionProfile).then(() => {
|
||||||
telemetryService.verify(x => x.publicLog(
|
telemetryService.verify(x => x.publicLog(
|
||||||
TypeMoq.It.is(a => a === telemetryKey),
|
TypeMoq.It.is(a => a === telemetryKey),
|
||||||
TypeMoq.It.is(b => b.provider === providerName
|
TypeMoq.It.is(b => b!.provider === providerName
|
||||||
&& b.from === data.from
|
&& b!.from === data.from
|
||||||
&& b.target === data.target
|
&& b!.target === data.target
|
||||||
&& b.test1 === data.test1
|
&& b!.test1 === data.test1
|
||||||
&& b.connection === undefined)), TypeMoq.Times.once());
|
&& b!.connection === undefined)), TypeMoq.Times.once());
|
||||||
done();
|
done();
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
assert.fail(err);
|
assert.fail(err);
|
||||||
@@ -97,7 +97,7 @@ suite('SQL Telemetry Utilities tests', () => {
|
|||||||
|
|
||||||
const logService = new NullLogService();
|
const logService = new NullLogService();
|
||||||
TelemetryUtils.addTelemetry(telemetryService.object, logService, telemetryKey, data, connectionProfile).then(() => {
|
TelemetryUtils.addTelemetry(telemetryService.object, logService, telemetryKey, data, connectionProfile).then(() => {
|
||||||
telemetryService.verify(x => x.publicLog(TypeMoq.It.is(a => a === telemetryKey), TypeMoq.It.is(b => b.provider === data.provider)), TypeMoq.Times.once());
|
telemetryService.verify(x => x.publicLog(TypeMoq.It.is(a => a === telemetryKey), TypeMoq.It.is(b => b!.provider === data.provider)), TypeMoq.Times.once());
|
||||||
done();
|
done();
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
assert.fail(err);
|
assert.fail(err);
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
"strictNullChecks": true,
|
"strictNullChecks": true,
|
||||||
"noImplicitAny": true,
|
"noImplicitAny": true,
|
||||||
"suppressImplicitAnyIndexErrors": true,
|
"suppressImplicitAnyIndexErrors": true,
|
||||||
"moduleResolution": "classic"
|
"skipLibCheck": true
|
||||||
},
|
},
|
||||||
"include": [
|
"include": [
|
||||||
"./typings",
|
"./typings",
|
||||||
@@ -22,8 +22,5 @@
|
|||||||
"./sql/platform/credentials/**/*.ts",
|
"./sql/platform/credentials/**/*.ts",
|
||||||
"./sql/platform/theme/**/*.ts",
|
"./sql/platform/theme/**/*.ts",
|
||||||
"./sql/platform/telemetry/**/*.ts"
|
"./sql/platform/telemetry/**/*.ts"
|
||||||
],
|
|
||||||
"exclude": [
|
|
||||||
"node_modules/**"
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -297,7 +297,7 @@ function topStep<T>(array: ReadonlyArray<T>, compare: (a: T, b: T) => number, re
|
|||||||
*/
|
*/
|
||||||
export function coalesce<T>(array: ReadonlyArray<T | undefined | null>): T[] {
|
export function coalesce<T>(array: ReadonlyArray<T | undefined | null>): T[] {
|
||||||
if (!array) {
|
if (!array) {
|
||||||
return undefined; // {{SQL CARBON EDIT}} @anthonydresser strict-null-checks
|
return array as T[]; // {{SQL CARBON EDIT}} @anthonydresser strict-null-checks
|
||||||
}
|
}
|
||||||
return <T[]>array.filter(e => !!e);
|
return <T[]>array.filter(e => !!e);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ export class ProductService implements IProductService {
|
|||||||
|
|
||||||
get vscodeVersion(): string { return '1.35.0'; } // {{SQL CARBON EDIT}} add vscodeversion
|
get vscodeVersion(): string { return '1.35.0'; } // {{SQL CARBON EDIT}} add vscodeversion
|
||||||
|
|
||||||
get recommendedExtensionsByScenario(): { [area: string]: Array<string> } { return this.productConfiguration.recommendedExtensionsByScenario; }// {{SQL CARBON EDIT}} add getter
|
get recommendedExtensionsByScenario(): { [area: string]: Array<string> } { return this.productConfiguration ? this.productConfiguration.recommendedExtensionsByScenario : {}; }// {{SQL CARBON EDIT}} add getter
|
||||||
|
|
||||||
get commit(): string | undefined { return this.productConfiguration ? this.productConfiguration.commit : undefined; }
|
get commit(): string | undefined { return this.productConfiguration ? this.productConfiguration.commit : undefined; }
|
||||||
|
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ export class AppInsightsAppender implements ITelemetryAppender {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
flush(): Promise<any> | undefined {
|
flush(): Promise<any> {
|
||||||
if (this._aiClient) {
|
if (this._aiClient) {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
this._aiClient!.flush({
|
this._aiClient!.flush({
|
||||||
@@ -85,6 +85,6 @@ export class AppInsightsAppender implements ITelemetryAppender {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return undefined;
|
return Promise.resolve(undefined);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user