Skip to content

solve undefined value property issue - #1465

Closed
dharamdan01 wants to merge 1 commit into
acornjs:masterfrom
dharamdan01:fix/1285-token-value-type
Closed

dharamdan01 wants to merge 1 commit into
acornjs:masterfrom
dharamdan01:fix/1285-token-value-type

Conversation

@dharamdan01

Copy link
Copy Markdown

Closes #1285
This PR fixes the missing value property in Acorn's Token TypeScript definition.
Although tokenizer().getToken() returns tokens containing a value at runtime, TypeScript previously rejected valid usage with Property 'value' does not exist on type 'Token'.

🛠️ How Was This Implemented?

  • Added a TypeScript declaration extension for the Token type.
  • Used module declaration merging to expose the existing value property to TypeScript consumers.
  • This allows token.getToken().value to type-check without as any or manual type casting.

Visuals

acorn-issue-1285

🧪 Testing Instructions

  1. Compile a TypeScript file using acorn.tokenizer().
  2. Call getToken() and access token.value.
  3. Verify that TypeScript no longer reports TS2339 for the value property.
  4. Verify that the token value is available at runtime as expected.
  5. Execute the script directly via CLI: npx tsx acorn/src/bin/test.ts (no typescript or @types required).

@marijnh

marijnh commented Oct 8, 2026

Copy link
Copy Markdown
Member

I don't know what this is, but I'm going to assume you let your 'agent' do some dumb stuff and are dumping it on us without further inspection. I don't have time for that.

@marijnh marijnh closed this Oct 8, 2026
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 this pull request may close these issues.

[acorn] Missing value property in Token (TypeScript)

2 participants