[Question] How to modify a property of a type alias?
See original GitHub issueI would like to go through all types and interfaces and replace the property member
if it exists. So I would like to change
interface X {
member: OldMember;
otherStuff: ...
}
type Y = {
member: OldMember;
otherStuff: ...
}
to
interface X {
member: NewMember;
otherStuff: ...
}
type Y = {
member: NewMember;
otherStuff: ...
}
For interfaces, I found I can do i.getProperty('member').set({ type: "NewMember" })
, but I was struggling to find the equivalent functions for types. What am I missing?
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Modify a TypeScript type alias from @types type - Stack Overflow
Using Typescript 3, I'm using a definition from DefinitelyTyped but I need to edit a type alias. I am using @types/json-schema for the...
Read more >Creating type aliases - Learn TypeScript
Using type aliases for functions type TypeAliasName = (paramName1: paramType1, ...) => ReturnType; Copy the function below and paste it in the code...
Read more >How To Use Type Aliases in TypeScript - DigitalOcean
In this tutorial, you will refactor code that uses string literals to include aliases. You will be able to use and understand TypeScript...
Read more >Type Aliases vs Interfaces in TypeScript - DEV Community
Type aliases are declared with the type keyword preceding them. Think of them like regular JavaScript variables that are used to represent ...
Read more >How to Override Specific Property Types Using TypeScript
Override specific property type annotations using mapped, conditional, and intersection types with TypeScript for interfaces or classes.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
No problem! Not much else to do right now haha 😄
Ah that did the trick. Thank you for walking me through it! Plus the amazing response time!