Hi all. Could someone explain me an difference of:
export type FeatureState = Readonly<{
entities: { [id: string]: Entity }
ids: string[]
}>
and
interface FeatureState {
readonly entities: { [id: string]: Entity }
readonly ids: string[]
}
?
phryneasToday at 10:48 AM
@dzintars There is none. Readonly is a mapped type that creates the second type
Well, minor differences. One is an interface and one is a type.
https://twitter.com/phry/status/1222241038884048896
Lenz Weber (@phry)
This #TypeScriptTuesday, we're going to take a look at #TypeScript's interfaces.
Interfaces are different from types and both have their strengths in different situations.
Let's take a look.
This is just some interface definition - again an example from the #redux types:
🧵👇
But in this situation that probably should not concern you, apart from the different "mouseover" behaviour
DzintarsToday at 11:00 AM
Thank you! Then.. what does the "industry" chooses in this context? Just interfaces?
phryneasToday at 11:02 AM
I've not seen any preference for one or the other really.
DzintarsToday at 11:35 AM
That tweet is really good. Thank you.
Hi all. Could someone explain me an difference of:
and
?
phryneasToday at 10:48 AM
@dzintars There is none. Readonly is a mapped type that creates the second type
Well, minor differences. One is an interface and one is a type.
https://twitter.com/phry/status/1222241038884048896
Lenz Weber (@phry)
This #TypeScriptTuesday, we're going to take a look at #TypeScript's interfaces.
Interfaces are different from types and both have their strengths in different situations.
Let's take a look.
This is just some interface definition - again an example from the #redux types:
🧵👇
But in this situation that probably should not concern you, apart from the different "mouseover" behaviour
DzintarsToday at 11:00 AM
Thank you! Then.. what does the "industry" chooses in this context? Just interfaces?
phryneasToday at 11:02 AM
I've not seen any preference for one or the other really.
DzintarsToday at 11:35 AM
That tweet is really good. Thank you.