Skip to content

Commit e08cd20

Browse files
committed
make ts happy
1 parent 2411b92 commit e08cd20

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

lib/commands/login/index.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,9 @@ export const login = {
9494
let enforcedOrgs = []
9595

9696
if (enforcedChoices.length > 1) {
97+
/**
98+
* @type { {id: string} }
99+
*/
97100
const { id } = await prompts({
98101
type: 'select',
99102
name: 'id',
@@ -107,6 +110,9 @@ export const login = {
107110
})
108111
if (id) enforcedOrgs = [id]
109112
} else if (enforcedChoices.length) {
113+
/**
114+
* @type { {confirmOrg: boolean} }
115+
*/
110116
const { confirmOrg } = await prompts({
111117
type: 'confirm',
112118
name: 'confirmOrg',
@@ -115,7 +121,10 @@ export const login = {
115121
onState: promptAbortHandler
116122
})
117123
if (confirmOrg) {
118-
enforcedOrgs = [enforcedChoices[0]?.value]
124+
const existing = /** @type {undefined | {value: string}} */(enforcedChoices[0])
125+
if (existing) {
126+
enforcedOrgs = [existing.value]
127+
}
119128
}
120129
}
121130
// MUST DO all updateSetting ON SAME TICK TO AVOID PARTIAL WRITE

lib/utils/issue-rules.cjs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,15 @@ module.exports = {
108108
* @returns {(context: {package: {name: string, version: string}, issue: {type: string}}) => RuleActionUX}
109109
*/
110110
createIssueUXLookup (settings) {
111+
/**
112+
* @type {Map<keyof (typeof settings.defaults.issueRules), RuleActionUX>}
113+
*/
111114
const cachedUX = new Map()
112115
return (context) => {
113116
const key = context.issue.type
117+
/**
118+
* @type {RuleActionUX | undefined}
119+
*/
114120
let ux = cachedUX.get(key)
115121
if (ux) {
116122
return ux

tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"cli.js"
55
],
66
"include": [
7+
"lib/utils/issue-rules.cjs",
78
"lib/**/*",
89
"test/**/*"
910
],

0 commit comments

Comments
 (0)