3 ms·
As long as the data is from within the system, yes. If you're trying to use data from an external source (api request, external json file etc) than no, but that
by bern4444 5y ago
As long as the data is from within the system, yes. If you're trying to use data from an external source (api request, external json file etc) than no, but that's true of most type systems.
If you correctly type the response of that request then the answer becomes yes again.
- pcthrowaway 5y agoMaybe I misunderstood, but I thought the person I was responding to was suggesting having the option for sound typing enforced in typescript, at compile time. Because if it's at run-time... well the run-time is Javascript, so there's of course no typing there. This isn't really on Typescript There are however javascript libraries which allow you specify object schemas and throw errors when mismatches occur. Perhaps the suggestion then is to build some shared layer between the TS compiler and V8 so that similar schemas can be autogenerated by the TS compiler and enforced at run-time.
- rsrsrs86 5y agoThere is generally no typing in run time. One of the practices in writing compilers is to skip type checks during run time, because you know beforehand that no type errors are possible. That is type erasure. If you're interested, lookup existential types. Very interesting stuff.