
- #TYPEFACES SCRIPT CODE#
- #TYPEFACES SCRIPT SERIES#
#TYPEFACES SCRIPT CODE#
you’re writing test code where you actually want the type system to error on an operation. While it’s entirely up to you and your team, we have some ideas of which to pick in certain situations. You might be tempted to switch existing // comments over to // and you might be wondering which is appropriate for future code. In some ways // can act as a suppression comment, similar to // difference is that // will do nothing if the following line is error-free. We’d like to extend a big thanks to Josh Goldberg, the contributor who implemented this feature.įor more information, you can take a look at the ts-expect-error pull request. The function’s types declare that it takes two strings so that other TypeScript users can get type-checking errors, but it also does a runtime check (maybe only in development builds) to give JavaScript users a helpful error. Imagine that we’re writing a library in TypeScript and we’re exporting some function called doStuff as part of our public API. While there’s still room for improvement, we hope this work translates to a snappier experience for everyone! // Comments TypeScript 3.9 addresses this issue by changing the internals of how the compiler and language service caches file lookups. We heard from the Visual Studio Code team that when renaming a file, just figuring out which import statements needed to be updated could take between 5 to 10 seconds. We also have some changes to file renaming functionality in editor scenarios. In total, we believe we’ve achieved around a 40% reduction in material-ui’s compile time! #TYPEFACES SCRIPT SERIES#
We’ve dived deep here, with a series of different pull requests that optimize certain pathological cases involving large unions, intersections, conditional types, and mapped types.Įach of these pull requests gains about a 5-10% reduction in compile times on certain codebases. Our team has been focusing on performance after observing extremely poor editing/compilation speed with packages like material-ui and styled-components.
TypeScript 3.9 ships with many new speed improvements. We’ll be experimenting more with the feature, but we won’t be shipping it as part of this release. We initially anticipated shipping awaited in TypeScript 3.9, but as we’ve run early TypeScript builds with existing codebases, we’ve realized that the feature needs more design work before we can roll it out to everyone smoothly.Īs a result, we’ve decided to pull the feature out of our main branch until we feel more confident. This goal of this type operator is to accurately model the way that Promise unwrapping works in JavaScript. If you’ve been following our issue tracker and design meeting notes, you might be aware of some work around a new type operator called awaited.
If you’ve been stuck on older versions of TypeScript due to issues around Promises, we encourage you to give 3.9 a shot! What About the awaited Type? Thanks to a pull request from Jack Bates, this has been fixed with improvements in our inference process in TypeScript 3.9. The fact that sealExhibit contained an undefined somehow poisoned type of lion to include undefined.