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 picks up code in comment #4464

Closed
jakajancar opened this issue Mar 23, 2020 · 3 comments
Closed

Deno picks up code in comment #4464

jakajancar opened this issue Mar 23, 2020 · 3 comments
Labels
bug Something isn't working correctly

Comments

@jakajancar
Copy link

Ran into this error while working on fp-ts:

% cat import-in-comment.ts 
function hello(who: string): string {
  return `hello ${who}`;
}
/**
 * `
 * import { scanLeft } from 'some/path/in/comment.ts'
 */

% deno import-in-comment.ts
Compile file:///Users/jaka/Desktop/import-in-comment.ts
error: Uncaught URIError: relative import path "some/path/in/comment.ts" not prefixed with / or ./ or ../ Imported from "file:///Users/jaka/Desktop/import-in-comment.ts"
► $deno$/errors.ts:35:13
    at constructError ($deno$/errors.ts:35:13)
    at unwrapResponse ($deno$/dispatch_json.ts:41:12)
    at sendSync ($deno$/dispatch_json.ts:70:10)
    at resolveModules ($deno$/compiler_imports.ts:70:10)
    at processImports ($deno$/compiler_imports.ts:172:27)
    at processImports ($deno$/compiler_imports.ts:181:13)

Some rogue regexp somewhere?

@ry ry added the bug Something isn't working correctly label Mar 23, 2020
@nayeemrmn
Copy link
Collaborator

Potential duplicate: #3089. Same TS bug I guess.

@kitsonk
Copy link
Contributor

kitsonk commented Mar 23, 2020

Duplicate of #3089

It isn't the comment persay... it is the backtick. The TypeScript pre-process parser gets confused. A work around, remove the backtick. If you want JSDoc that works until the issue in TypeScript is resolved, don't use backticks for code, use four spaces indented above the previous paragraph:

function hello(who: string): string {
  return `hello ${who}`;
}
/**
 * Example that works:
 *
 *     import { scanLeft } from 'some/path/in/comment.ts'
 */

@bartlomieju
Copy link
Member

Closing in favor of #3089

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly
Projects
None yet
Development

No branches or pull requests

5 participants