webgpu-types
v0.0.1
Published
Complete TypeScript type definitions for WebGPU
Maintainers
Readme
gpuweb
Complete TypeScript type definitions for WebGPU, implementing the full WebGPU specification.
Overview
This package provides comprehensive TypeScript type definitions for the WebGPU API, following the latest specification from https://gpuweb.github.io/gpuweb/. It can be used as a replacement for @types/webgpu with full coverage of all WebGPU features.
Installation
npm install gpuweb --save-dev
Usage
Once installed, you can use WebGPU types in your TypeScript projects: // Example: Initializing WebGPU async function initWebGPU() { if (!navigator.gpu) { throw new Error("WebGPU is not supported in this browser"); }
const adapter = await navigator.gpu.requestAdapter(); if (!adapter) { throw new Error("No appropriate GPU adapter found"); }
const device = await adapter.requestDevice();
// Create a buffer const buffer = device.createBuffer({ size: 1024, usage: GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_DST });
// Use other WebGPU features... }
Features
- Complete coverage of all WebGPU interfaces, types and enums
- Strict adherence to the official WebGPU specification
- Type-safe access to all WebGPU features and extensions
- Up-to-date with the latest WebGPU API changes
Documentation
License
MIT
