Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

[P2] Parser rejects contextual keywords as class declaration names

Closed Beginner friendly
#2,513 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
csharp, typescript
Domain
backend, compilers

Research direction

Start with Parser.Classes.cs, especially ClassDeclaration, and trace how it recognizes class names and distinguishes contextual keywords from reserved words. Compare the accepted syntax with TypeScript’s behavior, then run the parser tests or the reproduction with class type. Done means contextual keywords valid in this position are accepted while invalid reserved words and ordinary identifier class names retain their behavior.

Written by the indexing model from the issue text.

Description

Reproduction
class type {
    static create() {}
    instanceMethod() {}
}

Pinned TypeScript 6.0.3 accepts this source with --strict --target ES2022 --noEmit --skipLibCheck (exit 0).

SharpTS rejects it with Expect class name. before constructing the class AST. Parser.Classes.cs:ClassDeclaration currently consumes only TokenType.IDENTIFIER, although type is a valid contextual keyword in this identifier position.

Observed impact

The same declaration submitted to the REPL emits parser errors, leaves the accumulated statement list empty, and consequently cannot provide type. static-member completion. This is independent of the recent REPL token-origin fix: the class declaration fails before completion/type checking.

Regression provenance

The source fails identically in the retained clean base build from before PR #2504 (SharpTS DLL SHA256 FAA3C1907C5A578E4D18183D59D20BA4527A68BD1090EF99E786757713D3F82A) and the current build (DLL SHA256 F5934D2719A513245BB4FE8B4F492940584FFB5CD0BE28588736C6CA03C6CFDF). This is a preexisting parser gap, not a regression introduced by that PR.

All-state deduplication found related closed contextual-keyword/property-name reports #28, #36, and #138; those cover other syntactic positions rather than class declaration names.

Expected

Accept contextual keywords that TypeScript permits as class declaration names, while continuing to reject reserved words that are invalid in that position. Keep ordinary identifier class declarations working.

Dominant language
C#
Stars
156
Forks
4
Avg merge
6h 25m
Merged PRs (30d)
43

Getting set up

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.

More from nickna/SharpTS

All issues in nickna/SharpTS

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.