microsoft / microsoft/TypeScript

Allow ability to do an in-place override (_not_ extend) of interface properties

Open
#26,011 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Awaiting More Feedback Suggestion
Dominant language
Go
Stars
111k
Forks
14.3k
Avg merge
2d 4h
Merged PRs (30d)
132

Description

Search Terms

override interface
override interface replace

Suggestion

It would be nice to be able to override (not extend) third party libraries' interfaces to change the types/signatures of the interface properties.

Use Cases

Sometimes they make mistakes or define interfaces in ways that force me to constantly use as to typecast. I'd rather short-circuit it in one place so it works across my project.

Examples

Reference: https://stackoverflow.com/questions/51562792/how-to-override-a-typescript-interface-without-extending

Checklist

My suggestion meets these guidelines:
(Honestly I'm in no position to make these judgment calls, as I don't know the inner workings of this library - why ask these quesitons?)

  • This wouldn't be a breaking change in existing TypeScript / JavaScript code
  • This wouldn't change the runtime behavior of existing JavaScript code
  • This could be implemented without emitting different JS based on the types of the expressions (not sure what this means)
  • This isn't a runtime feature (e.g. new expression-level syntax) (???)

Contributor guide

Open the contributing guide

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.

Research direction

No source files, tests, or compiler entry points are identified. Start by reading the requested override behavior and the linked Stack Overflow discussion, then trace how TypeScript currently handles third-party interface declarations and type assertions. Done means a precisely defined override mechanism with agreed type-checking behavior and coverage for the reported use case.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.