Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@webgpu/types

Package Overview
Dependencies
Maintainers
5
Versions
95
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@webgpu/types

This package defines Typescript types (`.d.ts`) for the upcoming [WebGPU standard](https://github.com/gpuweb/gpuweb/wiki/Implementation-Status).

  • 0.1.6
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
559K
decreased by-17.03%
Maintainers
5
Weekly downloads
 
Created
Source

Typescript Type Definitions for WebGPU

This package defines Typescript types (.d.ts) for the upcoming WebGPU standard.

This package matches the work-in-progress WebGPU API, which is currently unstable!

Use this package to augment the ambient "dom" type definitions with the new definitions for WebGPU.

What are declaration files?

See the TypeScript handbook.

How can I use them?

Install

  • npm: npm install --save @webgpu/types
  • yarn: yarn add @webgpu/types

Configure

TypeScript tsc and tsc-based bundlers

In tsconfig.json:

{
  // ...
  "compilerOptions": {
    // ...
    "typeRoots": [ "./node_modules/@webgpu/types", "./node_modules/@types"]
  }
}
Webpack

In webpack.config.js add:

"types": ["@webgpu/types"]

(may not be necessary with tsc config above - untested)

Inline in TypeScript
/// <reference types="@webgpu/types" />
Others?

Please contribute a PR to add instructions for other setups or improve existing instructions. :)

How to update these types

  • Make sure the submodule is checked out: git submodule update --init
  • Pull gpuweb changes: pushd gpuweb && git checkout main && git pull && popd
  • Install dependencies: npm ci
  • Generate generated/index.d.ts: npm run generate
  • Open a diff between generated/index.d.ts and dist/index.d.ts. The generated file is tracked by Git so you can see what has changed. Update the latter according to changes from the former. Note the generated/ and dist/ files are not the same. See below for intentional differences.
  • Format the result: npm run format

Intentional differences between generator output and final result

Most or all of these should be fixed in the generator over time.

  • Array changed to Iterable for WebIDL sequences in argument positions.
  • any changed to object for WebIDL object.
  • | SharedArrayBuffer added for [AllowShared] BufferSource.

The following differences are TODO: should be changed in the final result.

  • Deprecated items should be removed.

The following differences will remain.

  • onuncapturederror strongly typed.
  • getContext definitions.
  • GPUExtent3DStrict (and similar).

Publish a new npm package version

(only for people who have npm publish access)

git checkout main && git pull git@github.com:gpuweb/types.git main && git submodule init --update && npm version patch && git push git@github.com:gpuweb/types.git main --tags && npm publish

FAQs

Package last updated on 07 Aug 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc