microsoft / microsoft/TypeScript
Implement interface should not add optional properties
Open
Nobody has claimed this yet.
Awaiting More Feedback
Domain: LS: Quick Fixes
Suggestion
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 132
Description
From https://github.com/Microsoft/vscode/issues/46286
TypeScript Version: 2.8.0-dev.20180320
Search Terms:
- implement interface
- quick fix
- code action
- optional property
Code
interface IFoo {
x?: number
y: number
}
class Foo implements IFoo {
}
Trigger implement interface on Foo
Expected behavior:
Only required properties required:
interface IFoo {
x?: number
y: number
}
class Foo implements IFoo {
y: number;
}
Actual behavior:
Both required and optional properties added:
interface IFoo {
x?: number
y: number
}
class Foo implements IFoo {
x?: number;
y: number;
}
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
Start at the TypeScript language-service code action invoked by “implement interface” and reproduce the provided IFoo/Foo example. Check the generated implementation members, then verify that only the required y property is added while optional x is omitted.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100