microsoft / microsoft/TypeScript
parameter property's modifier may not be followed by newline
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 132
Description
TypeScript Version: has been that way since at least 2.4
Search Terms:
Code
class Foo {
constructor(public
foo: string) {}
}
Expected behavior:
Treat is as a parameter property. Or at least document this in the spec (related #28395)
Actual behavior:
Treats it as two parameters with a syntax error because of a missing comma.
Playground Link: https://agentcooper.github.io/typescript-play/#code/MYGwhgzhAEBiD29oG8BQ1rHgOwgFwCcBXYPeAgCgAciAjEAS2HQ2gDNEAuafAh7AOYBKFAF9UooA
Related Issues:
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the constructor snippet in the linked TypeScript Playground and compare its behavior with the expected parameter-property interpretation. Trace the parser handling for a modifier followed by a newline, using related issue #28395 for context; done means this form is accepted as a parameter property instead of producing the missing-comma syntax error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 52/100