jquery / jquery/esprima

RegexLiteral source - invalid Type Object syntax?

Open
#2,008 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
7.1k
Forks
772
PR merge metrics
No merged PRs in 30d

Description

I think following line is not a valid TypeScript:

https://github.com/jquery/esprima/blob/a971d877fe7af52d5518d25a758835dc51cd7dbe/src/nodes.ts#L632

I think a semicolon should be used instead:

readonly regex: { pattern: string; flags: string };

See Object Types.

The TS compiler seems to accept the code without any warnings. Perhaps I am wrong and this is not an object type, but I cannot see what else it could be.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Open src/nodes.ts at line 632 and compare the declaration with the linked TypeScript Object Types specification. Check how the TypeScript compiler parses and accepts this syntax, then determine whether the declaration needs the proposed semicolon change. Done means the syntax is verified and the issue is resolved with the appropriate source update or explanation.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.