2 ms·
No, nominal types are extremely useful to ensure the correctness of your software. You can define a function to receive a FirstName and LastName instead of pass
by tigershark 6y ago
No, nominal types are extremely useful to ensure the correctness of your software.
You can define a function to receive a FirstName and LastName instead of passing strings so you cannot accidentally mix up the parameters for example.
There are several techniques to approximate nominal typing in typescript (https://medium.com/better-programming/nominal-typescript-eee36e9432d2 https://medium.com/better-programming/nominal-typescript-eee... for example) and there is an open issue https://github.com/Microsoft/Typescript/issues/202 https://github.com/Microsoft/Typescript/issues/202 but it’s still not being considered for implementation as far as I remember.