Fix hygiene/compile issues (release/1.26) (#14261)

* Fix hygiene issues

* Fix strict compile

* fixes

* compile fix

* more fixes

* more compile fixes

* last one?!

* fix tests
This commit is contained in:
Charles Gagnon
2021-02-11 22:02:55 -08:00
committed by GitHub
parent 4b87a0869f
commit abea315abb
34 changed files with 83 additions and 81 deletions

View File

@@ -8,7 +8,7 @@
*/
export class Deferred<T> {
promise: Promise<T>;
resolve!: (value?: T | PromiseLike<T>) => void;
resolve!: (value: T | PromiseLike<T>) => void;
reject!: (reason?: any) => void;
constructor() {
this.promise = new Promise<T>((resolve, reject) => {

View File

@@ -109,7 +109,7 @@ export function getDatabaseStateDisplayText(state: string): string {
* @returns Promise resolving to the user's input if it passed validation,
* or undefined if the input box was closed for any other reason
*/
async function promptInputBox(title: string, options: vscode.InputBoxOptions): Promise<string> {
async function promptInputBox(title: string, options: vscode.InputBoxOptions): Promise<string | undefined> {
const inputBox = vscode.window.createInputBox();
inputBox.title = title;
inputBox.prompt = options.prompt;

View File

@@ -7,7 +7,7 @@ import { Deferred } from '../../common/promise';
describe('Deferred', () => {
it('Then should be called upon resolution', function (done): void {
const deferred = new Deferred();
const deferred = new Deferred<void>();
deferred.then(() => {
done();
});

View File

@@ -29,7 +29,7 @@ describe('filePicker', function (): void {
should(filePicker.filePathInputBox.value).should.not.be.undefined();
filePicker.value!.should.equal(initialPath);
filePicker.component().items.length.should.equal(2, 'Filepicker container should have two components');
const deferred = new Deferred();
const deferred = new Deferred<void>();
sinon.stub(vscode.window, 'showOpenDialog').callsFake(async (_options) => {
deferred.resolve();
return [newFileUri];