Skip to content

Conversation

@Chakroun-Anas
Copy link

@Chakroun-Anas Chakroun-Anas commented Oct 30, 2025

Issue: #20

Problem:

The parser crashes with Unexpected character '@' when a decorator appears immediately after an interface or type declaration, which is common in Angular and NestJS codebases.

Example:

interface User {
  id: number;
  name: string;
}

@Injectable()
export class UserService {
  getUser() { return null; }
}

Root cause

After parsing the interface closing }, the parser calls next() to advance to the @ character while still in type parsing mode. The getTokenFromCodeInType method didn't handle @ , causing it to fall through to the base parser which doesn't recognise decorators.

Solution

Added @ character handling in getTokenFromCodeInType method moving the position of the cursor and finishing by calling finishToken with the token type @

Testing

  • All 188 tests pass (187 existing + 1 new)
  • No breaking changes

@changeset-bot
Copy link

changeset-bot bot commented Oct 30, 2025

⚠️ No Changeset found

Latest commit: d80ccbd

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

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.

1 participant