Skip to content

Commit

Permalink
Updates to Typescript 3.6.1
Browse files Browse the repository at this point in the history
Reworks generator types
  • Loading branch information
eamodio committed Aug 19, 2019
1 parent 4e11fe5 commit c3d532c
Show file tree
Hide file tree
Showing 13 changed files with 187 additions and 147 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5505,7 +5505,7 @@
},
"devDependencies": {
"@types/lodash-es": "4.17.3",
"@types/node": "10.11.7",
"@types/node": "10.14.15",
"@types/vscode": "1.37.0",
"@typescript-eslint/eslint-plugin": "2.0.0",
"@typescript-eslint/parser": "2.0.0",
Expand All @@ -5529,7 +5529,7 @@
"sass-loader": "7.2.0",
"terser-webpack-plugin": "1.4.1",
"ts-loader": "6.0.4",
"typescript": "3.5.3",
"typescript": "3.6.1-rc",
"vsce": "1.66.0",
"webpack": "4.39.2",
"webpack-bundle-analyzer": "3.4.1",
Expand Down
22 changes: 12 additions & 10 deletions src/commands/git/checkout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { ProgressLocation, QuickInputButton, window } from 'vscode';
import { Container } from '../../container';
import { GitBranch, GitReference, GitTag, Repository } from '../../git/gitService';
import { GlyphChars } from '../../constants';
import { getBranchesAndOrTags, QuickCommandBase, QuickInputStep, QuickPickStep, StepState } from '../quickCommand';
import { getBranchesAndOrTags, QuickCommandBase, StepAsyncGenerator, StepSelection, StepState } from '../quickCommand';
import { ReferencesQuickPickItem, RefQuickPickItem, RepositoryQuickPickItem } from '../../quickpicks';
import { Strings } from '../../system';
import { Logger } from '../../logger';
Expand Down Expand Up @@ -63,7 +63,7 @@ export class CheckoutGitCommand extends QuickCommandBase<State> {
));
}

protected async *steps(): AsyncIterableIterator<QuickPickStep | QuickInputStep> {
protected async *steps(): StepAsyncGenerator {
const state: StepState<State> = this._initialState === undefined ? { counter: 0 } : this._initialState;
let oneRepo = false;
let showTags = false;
Expand Down Expand Up @@ -93,9 +93,9 @@ export class CheckoutGitCommand extends QuickCommandBase<State> {
)
)
});
const selection = yield step;
const selection: StepSelection<typeof step> = yield step;

if (!this.canMoveNext(step, state, selection)) {
if (!this.canPickStepMoveNext(step, state, selection)) {
break;
}

Expand Down Expand Up @@ -169,9 +169,9 @@ export class CheckoutGitCommand extends QuickCommandBase<State> {
return true;
}
});
const selection = yield step;
const selection: StepSelection<typeof step> = yield step;

if (!this.canMoveNext(step, state, selection)) {
if (!this.canPickStepMoveNext(step, state, selection)) {
if (oneRepo) {
break;
}
Expand Down Expand Up @@ -213,9 +213,9 @@ export class CheckoutGitCommand extends QuickCommandBase<State> {
}
});

const value = yield step;
const value: StepSelection<typeof step> = yield step;

if (!(await this.canMoveNext(step, state, value))) {
if (!(await this.canInputStepMoveNext(step, state, value))) {
continue;
}

Expand Down Expand Up @@ -246,9 +246,9 @@ export class CheckoutGitCommand extends QuickCommandBase<State> {
}
]
);
const selection = yield step;
const selection: StepSelection<typeof step> = yield step;

if (!this.canMoveNext(step, state, selection)) {
if (!this.canPickStepMoveNext(step, state, selection)) {
continue;
}
}
Expand All @@ -262,5 +262,7 @@ export class CheckoutGitCommand extends QuickCommandBase<State> {
throw ex;
}
}

return undefined;
}
}
22 changes: 12 additions & 10 deletions src/commands/git/cherry-pick.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Container } from '../../container';
import { GitBranch, GitLogCommit, GitReference, Repository } from '../../git/gitService';
import { GlyphChars } from '../../constants';
import { Iterables, Strings } from '../../system';
import { getBranchesAndOrTags, QuickCommandBase, QuickInputStep, QuickPickStep, StepState } from '../quickCommand';
import { getBranchesAndOrTags, QuickCommandBase, StepAsyncGenerator, StepSelection, StepState } from '../quickCommand';
import {
BranchQuickPickItem,
CommitQuickPickItem,
Expand Down Expand Up @@ -38,7 +38,7 @@ export class CherryPickGitCommand extends QuickCommandBase<State> {
runGitCommandInTerminal('cherry-pick', state.source.ref, state.repo.path, true);
}

protected async *steps(): AsyncIterableIterator<QuickPickStep | QuickInputStep> {
protected async *steps(): StepAsyncGenerator {
const state: StepState<State> = this._initialState === undefined ? { counter: 0 } : this._initialState;
let oneRepo = false;

Expand Down Expand Up @@ -68,9 +68,9 @@ export class CherryPickGitCommand extends QuickCommandBase<State> {
)
)
});
const selection = yield step;
const selection: StepSelection<typeof step> = yield step;

if (!this.canMoveNext(step, state, selection)) {
if (!this.canPickStepMoveNext(step, state, selection)) {
break;
}

Expand Down Expand Up @@ -102,9 +102,9 @@ export class CherryPickGitCommand extends QuickCommandBase<State> {
return true;
}
});
const selection = yield step;
const selection: StepSelection<typeof step> = yield step;

if (!this.canMoveNext(step, state, selection)) {
if (!this.canPickStepMoveNext(step, state, selection)) {
if (oneRepo) {
break;
}
Expand Down Expand Up @@ -153,9 +153,9 @@ export class CherryPickGitCommand extends QuickCommandBase<State> {
)
]
});
const selection = yield step;
const selection: StepSelection<typeof step> = yield step;

if (!this.canMoveNext(step, state, selection)) {
if (!this.canPickStepMoveNext(step, state, selection)) {
continue;
}

Expand Down Expand Up @@ -186,9 +186,9 @@ export class CherryPickGitCommand extends QuickCommandBase<State> {
}
]
);
const selection = yield step;
const selection: StepSelection<typeof step> = yield step;

if (!this.canMoveNext(step, state, selection)) {
if (!this.canPickStepMoveNext(step, state, selection)) {
continue;
}

Expand All @@ -201,5 +201,7 @@ export class CherryPickGitCommand extends QuickCommandBase<State> {
throw ex;
}
}

return undefined;
}
}
18 changes: 10 additions & 8 deletions src/commands/git/fetch.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
'use strict';
import { Container } from '../../container';
import { Repository } from '../../git/gitService';
import { QuickCommandBase, QuickInputStep, QuickPickStep, StepState } from '../quickCommand';
import { QuickPickItemPlus, RepositoryQuickPickItem } from '../../quickpicks';
import { QuickCommandBase, StepAsyncGenerator, StepSelection, StepState } from '../quickCommand';
import { GitFlagsQuickPickItem, RepositoryQuickPickItem } from '../../quickpicks';
import { Strings } from '../../system';
import { GlyphChars } from '../../constants';
import { Logger } from '../../logger';
Expand Down Expand Up @@ -44,7 +44,7 @@ export class FetchGitCommand extends QuickCommandBase<State> {
});
}

protected async *steps(): AsyncIterableIterator<QuickPickStep | QuickInputStep> {
protected async *steps(): StepAsyncGenerator {
const state: StepState<State> = this._initialState === undefined ? { counter: 0 } : this._initialState;
let oneRepo = false;

Expand Down Expand Up @@ -77,9 +77,9 @@ export class FetchGitCommand extends QuickCommandBase<State> {
)
)
});
const selection = yield step;
const selection: StepSelection<typeof step> = yield step;

if (!this.canMoveNext(step, state, selection)) {
if (!this.canPickStepMoveNext(step, state, selection)) {
break;
}

Expand All @@ -88,7 +88,7 @@ export class FetchGitCommand extends QuickCommandBase<State> {
}

if (this.confirm(state.confirm)) {
const step = this.createConfirmStep<QuickPickItemPlus<string[]>>(
const step = this.createConfirmStep<GitFlagsQuickPickItem>(
`Confirm ${this.title}${Strings.pad(GlyphChars.Dot, 2, 2)}${
state.repos.length === 1
? state.repos[0].formattedName
Expand Down Expand Up @@ -137,9 +137,9 @@ export class FetchGitCommand extends QuickCommandBase<State> {
}
]
);
const selection = yield step;
const selection: StepSelection<typeof step> = yield step;

if (!this.canMoveNext(step, state, selection)) {
if (!this.canPickStepMoveNext(step, state, selection)) {
if (oneRepo) {
break;
}
Expand All @@ -162,5 +162,7 @@ export class FetchGitCommand extends QuickCommandBase<State> {
throw ex;
}
}

return undefined;
}
}
22 changes: 12 additions & 10 deletions src/commands/git/merge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
import { Container } from '../../container';
import { GitBranch, GitTag, Repository } from '../../git/gitService';
import { GlyphChars } from '../../constants';
import { getBranchesAndOrTags, QuickCommandBase, QuickInputStep, QuickPickStep, StepState } from '../quickCommand';
import { getBranchesAndOrTags, QuickCommandBase, StepAsyncGenerator, StepSelection, StepState } from '../quickCommand';
import {
BranchQuickPickItem,
Directive,
DirectiveQuickPickItem,
QuickPickItemPlus,
GitFlagsQuickPickItem,
RepositoryQuickPickItem,
TagQuickPickItem
} from '../../quickpicks';
Expand All @@ -31,7 +31,7 @@ export class MergeGitCommand extends QuickCommandBase<State> {
runGitCommandInTerminal('merge', [...state.flags, state.source.ref].join(' '), state.repo.path, true);
}

protected async *steps(): AsyncIterableIterator<QuickPickStep | QuickInputStep> {
protected async *steps(): StepAsyncGenerator {
const state: StepState<State> = this._initialState === undefined ? { counter: 0 } : this._initialState;
let oneRepo = false;

Expand Down Expand Up @@ -61,9 +61,9 @@ export class MergeGitCommand extends QuickCommandBase<State> {
)
)
});
const selection = yield step;
const selection: StepSelection<typeof step> = yield step;

if (!this.canMoveNext(step, state, selection)) {
if (!this.canPickStepMoveNext(step, state, selection)) {
break;
}

Expand All @@ -88,9 +88,9 @@ export class MergeGitCommand extends QuickCommandBase<State> {
picked: state.source && state.source.ref
})
});
const selection = yield step;
const selection: StepSelection<typeof step> = yield step;

if (!this.canMoveNext(step, state, selection)) {
if (!this.canPickStepMoveNext(step, state, selection)) {
if (oneRepo) {
break;
}
Expand Down Expand Up @@ -120,7 +120,7 @@ export class MergeGitCommand extends QuickCommandBase<State> {
break;
}

const step = this.createConfirmStep<QuickPickItemPlus<string[]>>(
const step = this.createConfirmStep<GitFlagsQuickPickItem>(
`Confirm ${this.title}${Strings.pad(GlyphChars.Dot, 2, 2)}${state.repo.formattedName}`,
[
{
Expand Down Expand Up @@ -150,9 +150,9 @@ export class MergeGitCommand extends QuickCommandBase<State> {
}
]
);
const selection = yield step;
const selection: StepSelection<typeof step> = yield step;

if (!this.canMoveNext(step, state, selection)) {
if (!this.canPickStepMoveNext(step, state, selection)) {
continue;
}

Expand All @@ -167,5 +167,7 @@ export class MergeGitCommand extends QuickCommandBase<State> {
throw ex;
}
}

return undefined;
}
}
18 changes: 10 additions & 8 deletions src/commands/git/pull.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
'use strict';
import { Container } from '../../container';
import { Repository } from '../../git/gitService';
import { QuickCommandBase, QuickInputStep, QuickPickStep, StepState } from '../quickCommand';
import { QuickPickItemPlus, RepositoryQuickPickItem } from '../../quickpicks';
import { QuickCommandBase, StepAsyncGenerator, StepSelection, StepState } from '../quickCommand';
import { GitFlagsQuickPickItem, RepositoryQuickPickItem } from '../../quickpicks';
import { Strings } from '../../system';
import { GlyphChars } from '../../constants';
import { Logger } from '../../logger';
Expand Down Expand Up @@ -41,7 +41,7 @@ export class PullGitCommand extends QuickCommandBase<State> {
return Container.git.pullAll(state.repos, { rebase: state.flags.includes('--rebase') });
}

protected async *steps(): AsyncIterableIterator<QuickPickStep | QuickInputStep> {
protected async *steps(): StepAsyncGenerator {
const state: StepState<State> = this._initialState === undefined ? { counter: 0 } : this._initialState;
let oneRepo = false;

Expand Down Expand Up @@ -74,9 +74,9 @@ export class PullGitCommand extends QuickCommandBase<State> {
)
)
});
const selection = yield step;
const selection: StepSelection<typeof step> = yield step;

if (!this.canMoveNext(step, state, selection)) {
if (!this.canPickStepMoveNext(step, state, selection)) {
break;
}

Expand All @@ -85,7 +85,7 @@ export class PullGitCommand extends QuickCommandBase<State> {
}

if (this.confirm(state.confirm)) {
const step = this.createConfirmStep<QuickPickItemPlus<string[]>>(
const step = this.createConfirmStep<GitFlagsQuickPickItem>(
`Confirm ${this.title}${Strings.pad(GlyphChars.Dot, 2, 2)}${
state.repos.length === 1
? state.repos[0].formattedName
Expand Down Expand Up @@ -114,9 +114,9 @@ export class PullGitCommand extends QuickCommandBase<State> {
}
]
);
const selection = yield step;
const selection: StepSelection<typeof step> = yield step;

if (!this.canMoveNext(step, state, selection)) {
if (!this.canPickStepMoveNext(step, state, selection)) {
if (oneRepo) {
break;
}
Expand All @@ -139,5 +139,7 @@ export class PullGitCommand extends QuickCommandBase<State> {
throw ex;
}
}

return undefined;
}
}

0 comments on commit c3d532c

Please sign in to comment.