Hi, I've got a yargs TS code, like:
let argv = hideBin(process.argv)
let optParser = yargs(argv)
.scriptName('')
.usage(usage)
.epilogue(epilogue)
.help()
.version(false)
.parserConfiguration({ 'populate--': true })
.strict()
.options({
port: {
group: configOptionsGroup,
describe: `Port to use [${Server.DEFAULT_PORT}]`,
type: 'string',
},
project: {
group: configOptionsGroup,
describe: 'Open the specified project on startup',
type: 'string',
},
... // many more
)
let args = optParser.parse()
let foo = args.port
And TS tells me that port does not exist there, although it shows that it exists in the type:
Property 'port' does not exist on type '{ [x: string]: unknown; port: string; project: string; server: boolean; window: boolean; "background-throttling": boolean; backgroundThrottling: boolean; backend: boolean; "backend-path": unknown; backendPath: unknown; ... 30 more ...; $0: string; } | Promise<...>'.
Property 'port' does not exist on type 'Promise<{ [x: string]: unknown; port: string; project: string; server: boolean; window: boolean; "background-throttling": boolean; backgroundThrottling: boolean; backend: boolean; "backend-path": unknown; backendPath: unknown; ... 30 more ...; $0: string; }>'.
227 let foo = args.port
I see it in the type, would anyone be so nice and tell me what I'm missing here, please? 🙂