Skip to content
Advertisement

Typescript custom type

If I have an interface in typescript like so

JavaScript

How can I factor out my type for text with the pipes so I can use it multiple times as a type in my program? It seems like it should be simple but I’m not sure what the syntax is

For clarity I would like to be able to use it like

JavaScript

etc… I can’t seem to find the syntax to this question so help is appreciated.

Advertisement

Answer

I think you just need the type keyword:

JavaScript

Not near a compiler now so can’t really check but I think that works

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement