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

deno check --doc does not respect @ts-expect-error directives in JSDoc examples #26728

Closed
laurence-myers opened this issue Nov 5, 2024 · 0 comments · Fixed by #26828
Closed
Assignees

Comments

@laurence-myers
Copy link

Version: Deno 2.0.3

In file example.ts:

/**
 * @example ```ts
 * import { add } from "./example.ts";
 *
 * add(1, 2);
 *
 * // @ts-expect-error: can only add numbers
 * add('1', '2');
 * ```
 */
export function add(first: number, second: number) {
  return first + second;
}

(@ts-ignore has the same problem)

Expected

deno check --doc ./example.ts does not report an error.

Actual

deno check --doc ./example.ts report an error:

deno check --doc ./example.ts
Check file:///...snip.../example.ts
Check file:///...snip.../example.ts$2-10.ts
error: TS2345 [ERROR]: Argument of type 'string' is not assignable to parameter of type 'number'.
add('1', '2');
    ~~~
    at file:///...snip.../example.ts$2-10.ts:3:5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants