Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get just TypeScript types from threeJs package?

I'm building a front-end with Webpack that includes threeJs functionality. In the past, I used to NOT include threeJs in my bundle to keep it small (I used the threeJs UMD from a CDN link in my index.html). I did however use the @types/three package for typing.

However, @types/three has now been deprecated. Instead, three now includes its own moduled types. But now, I can't figure out how to use the three package just for its types without also including ALL of the massive threeJs code in my bundle.

Suggestions?

like image 507
Magnus Avatar asked Jan 19 '26 12:01

Magnus


1 Answers

It was initially deprecated, but @types/three is now the place to use again. Moving back to DefinitivelyTyped was done in Jan 2021.

So just add types by running

npm install -D @types/three
like image 140
Ben Butterworth Avatar answered Jan 21 '26 08:01

Ben Butterworth



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!