mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -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"
|
||||
}
|
||||
},
|
||||
{
|
||||
"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",
|
||||
"task": "tslint",
|
||||
|
||||
@@ -35,9 +35,9 @@ steps:
|
||||
yarn tslint
|
||||
displayName: 'Run TSLint'
|
||||
|
||||
# - script: |
|
||||
# yarn strict-null-check
|
||||
# displayName: 'Run Strict Null Check'
|
||||
- script: |
|
||||
yarn strict-null-check
|
||||
displayName: 'Run Strict Null Check'
|
||||
|
||||
- script: |
|
||||
yarn compile
|
||||
|
||||
@@ -20,9 +20,9 @@ steps:
|
||||
yarn tslint
|
||||
displayName: 'Run TSLint'
|
||||
|
||||
# - script: |
|
||||
# yarn strict-null-check
|
||||
# displayName: 'Run Strict Null Check'
|
||||
- script: |
|
||||
yarn strict-null-check
|
||||
displayName: 'Run Strict Null Check'
|
||||
|
||||
- script: |
|
||||
yarn compile
|
||||
|
||||
@@ -18,7 +18,7 @@ export class DBCellValue {
|
||||
/**
|
||||
* 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 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
|
||||
*/
|
||||
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 valueToDisplay = '';
|
||||
let titleValue = '';
|
||||
|
||||
@@ -22,7 +22,7 @@ suite('SQL Telemetry Utilities tests', () => {
|
||||
serverName: '',
|
||||
authenticationType: '',
|
||||
getOptionsKey: () => '',
|
||||
matches: undefined,
|
||||
matches: () => false,
|
||||
groupFullName: '',
|
||||
groupId: '',
|
||||
id: '',
|
||||
@@ -44,7 +44,7 @@ suite('SQL Telemetry Utilities tests', () => {
|
||||
};
|
||||
const logService = new NullLogService();
|
||||
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();
|
||||
}).catch(err => {
|
||||
assert.fail(err);
|
||||
@@ -63,11 +63,11 @@ suite('SQL Telemetry Utilities tests', () => {
|
||||
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
|
||||
&& b.from === data.from
|
||||
&& b.target === data.target
|
||||
&& b.test1 === data.test1
|
||||
&& b.connection === undefined)), TypeMoq.Times.once());
|
||||
TypeMoq.It.is(b => b!.provider === providerName
|
||||
&& b!.from === data.from
|
||||
&& b!.target === data.target
|
||||
&& b!.test1 === data.test1
|
||||
&& b!.connection === undefined)), TypeMoq.Times.once());
|
||||
done();
|
||||
}).catch(err => {
|
||||
assert.fail(err);
|
||||
@@ -97,7 +97,7 @@ suite('SQL Telemetry Utilities tests', () => {
|
||||
|
||||
const logService = new NullLogService();
|
||||
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();
|
||||
}).catch(err => {
|
||||
assert.fail(err);
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
"strictNullChecks": true,
|
||||
"noImplicitAny": true,
|
||||
"suppressImplicitAnyIndexErrors": true,
|
||||
"moduleResolution": "classic"
|
||||
"skipLibCheck": true
|
||||
},
|
||||
"include": [
|
||||
"./typings",
|
||||
@@ -22,8 +22,5 @@
|
||||
"./sql/platform/credentials/**/*.ts",
|
||||
"./sql/platform/theme/**/*.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[] {
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ export class ProductService implements IProductService {
|
||||
|
||||
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; }
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ export class AppInsightsAppender implements ITelemetryAppender {
|
||||
});
|
||||
}
|
||||
|
||||
flush(): Promise<any> | undefined {
|
||||
flush(): Promise<any> {
|
||||
if (this._aiClient) {
|
||||
return new Promise(resolve => {
|
||||
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