Re:Tips for Performant TypeScript
by ragnese on Wednesday November 25, 2020 @02:55PM
(#25213554)
> I suppose there could actually be runtime consequences of TypeScript too, as you’re still writing runtime code, just through a game of telephone with TypeScript :p
Right. One of the first things you learn while doing TypeScript is that interfaces don't exist after compile time. So in general, it's better to write interfaces and use plain-old-objects than to use `class`, which generates real JavaScript code.
Within reason, of course. Classes are still useful. But it's not necessarily the first thing to reach for.
Right. One of the first things you learn while doing TypeScript is that interfaces don't exist after compile time. So in general, it's better to write interfaces and use plain-old-objects than to use `class`, which generates real JavaScript code.
Within reason, of course. Classes are still useful. But it's not necessarily the first thing to reach for.