Skip to content

More invalid JSDoc generate cases #38626

Closed
@Jack-Works

Description

@Jack-Works

TypeScript Version: 4.0.0-dev.20200516

Search Terms:: JSDoc invalid dts

Code

/**
  * @param {Array=} y desc
  */
function x(y) {}

/**
  * @param {function (Olm.InboundGroupSession)} func Invoked
 */
function y(func) {}

/**
 * @return {(Array.<> | null)} list of devices
 */
function z() {}

/**
 * 
 * @return {?Promise} A promise
 */
function w() {}
Compiler Options
{
  "compilerOptions": {
    "noImplicitAny": true,
    "strictFunctionTypes": true,
    "strictPropertyInitialization": true,
    "strictBindCallApply": true,
    "noImplicitThis": true,
    "noImplicitReturns": true,
    "alwaysStrict": true,
    "esModuleInterop": true,
    "checkJs": true,
    "allowJs": true,
    "declaration": true,
    "experimentalDecorators": true,
    "emitDecoratorMetadata": true,
    "moduleResolution": 2,
    "target": "ES2017",
    "jsx": "React",
    "module": "ESNext"
  }
}

Invalid outputs:

/**
  * @param {Array=} y desc
  */
declare function x(y?: Array | undefined): void;
// ~~~~~~~~~~~~~~~~~~~~~~~~~^ Missing generics

/**
  * @param {function (Olm.InboundGroupSession)} func Invoked
 */
declare function y(func: (arg0: any) => ): void;
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ invalid type signature

/**
 * @return {(Array.<> | null)} list of devices
 */
declare function z(): (Array | null);
// ~~~~~~~~~~~~~~~~~~~~~~~~~^ missing generics

/**
 *
 * @return {?Promise} A promise
 */
declare function w(): Promise | null;
// ~~~~~~~~~~~~~~~~~~~~~~~~~~^ missing generics

Playground Link: Provided

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScript

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions