denoland / denoland/deno_graph

`@ts-self-types` not detected if the file starts with a semicolon

Open
#569 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
Rust
Stars
137
Forks
47
Avg merge
2d 7h
Merged PRs (30d)
4

Description

`deno doc` is not picking up the `@ts-self-types` in https://jsr.io/@babel-test-6ae45912/core/0.0.5-8.0.0-alpha.15's `./lib/index.js`.

It seems like the problem is the semicolon in that file:
```ts
/* @ts-self-types="./index.d.ts" */
;
export const version = "7.26.8";
export { default as File } from "./transformation/file/file.js";
export { default as buildExternalHelpers } from "./tools/build-external-helpers.js";
```

If I remove it, it works.

I understand that it's weird to have a file starting with `;` (and tbh I'm not sure why my file has that 😅), but it's valid syntax and shouldn't affect the comment.

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the report with deno doc against the referenced ./lib/index.js, comparing the file with and without its leading semicolon. Trace the handling of the @ts-self-types comment and verify that the directive is detected when valid JavaScript begins with a semicolon; done means the reported JSR case works without removing that semicolon.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, typescript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.