Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More invalid JSDoc generate cases #38626

Closed
Jack-Works opened this issue May 18, 2020 · 2 comments · Fixed by #39011
Closed

More invalid JSDoc generate cases #38626

Jack-Works opened this issue May 18, 2020 · 2 comments · Fixed by #39011
Assignees
Labels
Bug A bug in TypeScript

Comments

@Jack-Works
Copy link
Contributor

Jack-Works commented May 18, 2020

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

@Jack-Works
Copy link
Contributor Author

And seems like fix in #38368 doesn't work on the return value

/**
 * 
 * @return {promise} A promise
 */
function w() {}
/**
 *
 * @return {promise} A promise
 */
declare function w(): any;

@Jack-Works
Copy link
Contributor Author

related #38356 @weswigham

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript
Projects
None yet
3 participants