gpuweb / types

TypeScript type definitions for WebGPU https://gpuweb.github.io/types/
https://www.npmjs.com/package/@webgpu/types
BSD 3-Clause "New" or "Revised" License
189 stars 38 forks source link

Question: can I use `types` property in compilerOption of tsconfig.json #135

Closed Lantianyou closed 1 year ago

Lantianyou commented 1 year ago

According to the docs, seems we can also use types without webpack

https:www.typescriptlang.org/tsconfig#typeRoots

like this:

{
  "compiloerOptions": {
      "types": [ "@webgpu/types"]
  }

}
Lantianyou commented 1 year ago

My point is, there is two ways to use this package, and readme section of webpack is unnecessary

kainino0x commented 1 year ago

Thanks for the extra method! I will definitely add it. It seems nicer than typeRoots.

I don't know anything about Webpack, someone contributed that bit of the instructions (cc @darionco). It seems Webpack has its own way to configure additional types. If you set the tsconfig option, do either of you know if then, you don't need the webpack.config.js option? If so, I'd prefer to remove the Webpack section.

kainino0x commented 1 year ago

In fact as it already says in the readme: "(may not be necessary with tsc config above - untested)" 🙂

kainino0x commented 1 year ago

BTW to clarify - the webpack instructions are definitely not needed if you don't use webpack already. I just don't know if you need them if you are using webpack.

Lantianyou commented 1 year ago

Thanks for your reply. Now I see why there is a section about webpack in the first place. Luckily, I do not use Webpack.

Lantianyou commented 1 year ago

I will close this issue as you have already answered my question

kainino0x commented 1 year ago

Thanks for confirming! And thanks for reporting, I was able to improve the README.