Skip to content

JSDoc: error TS1005 when using conditional type in @typedef #37166

Closed
@Serega124

Description

@Serega124

TypeScript Version: 3.9.0-dev.20200229

Search Terms: JSDoc typedef

Expected behavior: compile javascript JSDoc without any errors

Actual behavior: Actually, tsc compiles correct d.ts type, but annoying error '?' expected appears. You can see that error on the Playground's Errors tab.

Related Issues:

Code

/**
 * @template T
 * @typedef {{[K in keyof T]: T[K] extends Function ? K : never}[keyof T]} FunctionProperties
 */
Compiler Options
{
  "compilerOptions": {
    "noImplicitAny": true,
    "strictFunctionTypes": true,
    "strictPropertyInitialization": true,
    "strictBindCallApply": true,
    "noImplicitThis": true,
    "noImplicitReturns": true,
    "alwaysStrict": true,
    "noUnusedLocals": true,
    "noUnusedParameters": true,
    "esModuleInterop": true,
    "checkJs": true,
    "allowJs": true,
    "declaration": true,
    "experimentalDecorators": true,
    "emitDecoratorMetadata": true,
    "moduleResolution": 2,
    "target": "ES2017",
    "jsx": "React",
    "module": "ESNext"
  }
}

Playground Link: Provided

Metadata

Metadata

Assignees

Labels

Awaiting More FeedbackThis means we'd like to hear from more people who would be helped by this featureBugA bug in TypeScriptDesign LimitationConstraints of the existing architecture prevent this from being fixed

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions