TypeScript on the GPU – Bridging the Gap Between Realms

Bookmark
Rate this content

Join me for a technical deep-dive on TypeGPU which, among other things, allows your WebGPU shader to be made up of JavaScript either partially or entirely. This means a library can be written fully in WebGPU Shading Language, yet accept a JS callback that gets compiled and injected into the shader code. Improving APIs by going past just tweaking knobs and parameters.

In my talk, I’ll be touching upon how we offload most of this work to a build-step while still supporting dynamic scenarios, how we mitigate the differences between JavaScript and WebGPU Shading Language, and how we leverage existing tooling like the TypeScript language server to make CPU and GPU code connect seamlessly through types.

This talk has been presented at JSNation US 2025, check out the latest edition of this JavaScript Conference.

FAQ

TypeGPU is a TypeScript toolkit for WebGPU, started by Ivo Plaza around two years ago. It allows developers to write shaders in either JavaScript or TypeScript.

The Jelly Slider example is rendered in real time, responding to user interaction. It can be customized through its API by changing colors and using JavaScript callbacks to adjust visual effects.

No, TypeGPU has a limited JavaScript syntax and functionality to ensure that only relevant shader logic runs on the GPU, providing a closer connection to the platform.

WebGPU is a new web standard that allows browsers to access the user's graphics card, enabling advanced graphics and computations.

No, TypeScript is not required. TypeGPU works with JavaScript as well, although it utilizes TypeScript for end-to-end type safety.

TypeGPU is compatible with various bundlers, including Vite, Rollup, Webpack, ESBuild, and others.

TypeGPU allows console logging on the GPU, which helps in debugging by offering insights into the runtime logic of shaders.

TypeGPU is more low-level than 3JS but can be used to write shader functions in TypeScript that integrate with 3JS objects and scenes. It doesn't directly integrate with React 3 Fiber, which primarily uses WebGL.

While there is no automated tool currently, it is possible to convert GLSL shaders from ShaderToy to TypeGPU manually or with the help of AI tools.

Software Mansion is a software agency that builds React Native apps for businesses and creates and maintains open source libraries in the ecosystem.

Iwo Plaza
Iwo Plaza
31 min
17 Nov, 2025

Comments

Sign in or register to post your comment.
Video Summary and Transcription
Ivo Plaza introduces TypeGPU, a TypeScript toolkit for WebGPU, with a live Jelly Slider demo. The demo showcases interactive features and a customizable API for dynamic color changes. TypeGPU offers extensibility for library creators, allowing intricate customization and per-pixel operations. It demonstrates GPU material animation control, WebGPU support, efficient debugging with GPU console log, and memory allocation. WebGPU enables program execution, resembling REST API interactions between front-end and back-end. TypeGPU integrates JavaScript shaders with WebGPU shading language, utilizing TGPU Resolve API for shader conversion and shader code generation. It covers compile-time operations, function calls, runtime conditions in shaders, and code optimization. TypeGPU's TINYEST format, JS to AST conversion, WebGPU usage, and integration with 3JS and React 3 Fiber are discussed, highlighting the differences between WebGL and WebGPU. The Talk emphasizes the integration of TypeGPU with 3JS and React 3 Fiber, utilizing GPU directives, marketing effects, AI for shader conversion, and future possibilities.
Video transcription and chapters available for users with access.

Check out more articles and videos

We constantly think of articles and videos that might spark Git people interest / skill us up or help building a stellar career

Embracing WebGPU and WebXR With Three.js
JSNation 2024JSNation 2024
27 min
Embracing WebGPU and WebXR With Three.js
Top Content
The 3JS project has evolved into a community-driven effort with numerous contributors over the past 14 years. It started with 3D engine work in Flash and transitioned to using SVGs for rendering in HTML5 before adopting WebGL. The project showcases various projects and frameworks, including a no-code tool powered by 3.js. The team is working on a new render using WebGPU and developing a new shader language called TSL. The hope is that WebGPU will eventually replace WebGL, offering better control and performance.
Transformers.js: State-of-the-Art Machine Learning for the Web
JSNation 2025JSNation 2025
27 min
Transformers.js: State-of-the-Art Machine Learning for the Web
Joshua introduces Transformers JS and Hugging Face, emphasizing community collaboration and pre-trained models. Transformers JS evolution led to 1.4 million monthly users, supporting 155 architectures. The library's browser-based capabilities offer real-time processing, cost-efficiency, and scalability. Integration enhancements include native web GPU execution and React Native implementation. Web ML implementation focuses on Onyx Runtime for device execution and web GPU for resource optimization. Browser-based ML applications cover vision, speech recognition, and text-to-speech. Advanced implementations include multimodal applications and educational tools. Interactive AI demonstrations showcase semantic search and conversational AI scenarios. Model licensing transitions to ECMAScript for efficiency and model redownloading factors are discussed.
The State of the Web
JSNation 2025JSNation 2025
32 min
The State of the Web
Sasha Grief discusses the state of the web through web development surveys, leading to an interactive quiz about the state of JS and usage of front end frameworks. Discussion on popular front-end libraries like React, Vue, Angular, and the rising popularity of TypeScript among developers in recent surveys. Discussion on TypeScript adoption, TC39 committee proposals, favorite CSS feature 'has,' and browser support for 'has' selector. Browser interoperability, browser vendors' initiatives, AI usage among web developers, and survey insights. Job titles linked to higher income, diversity of survey topics, top hobby among developers, and popular specific video games. Learnings on CSS features, TypeScript default, AI usage, survey benefits, challenges in reaching diverse survey participants. Surprising positivity in JavaScript usage, stable framework landscape, AI adoption challenges, mainstream AI tools, successful situp.js survey. Inconsistent respondent numbers, manual data normalization efforts, subjective question selection process, community input, mitigation of selection bias. Reason for starting surveys, transition from Meteor JS, exploration of JavaScript ecosystem.
Unreal Engine in WebAssembly/WebGPU
JS GameDev Summit 2022JS GameDev Summit 2022
33 min
Unreal Engine in WebAssembly/WebGPU
Top Content
Alex Saint-Louis, co-founder of Wunder Interactive, shares the mission of bringing Unreal Engine to the browser, enabling cross-platform 3D applications and games. They are working on a WebGPU back end for Unreal Engine to push the limits of 3D on the web. Wunder Interactive has improved compression, built their own asset file system, and offers powerful tools for game developers. They are utilizing modern web technologies like WebAssembly, WebGL, and WebGPU, and plan to support other engines like Unity and Godot. The team aims to transform the industry by bringing console-quality games to the browser and providing an alternative distribution path. They are excited to bring Unreal Engine 5 to the web with WebGPU support and are working on WebXR support for cross-platform 3D experiences, including VR.
Makepad - Leveraging Rust + Wasm + WebGL to Build Amazing Cross-platform Applications
JSNation 2022JSNation 2022
22 min
Makepad - Leveraging Rust + Wasm + WebGL to Build Amazing Cross-platform Applications
Top Content
Welcome to MakePad, a new way to build UI for web and native using WebAssembly and Rust. JavaScript is not suitable for complex applications like IDEs and design tools. Rust, a new programming language, was used to reimagine MakePad, resulting in a fast and efficient platform. MakePad offers live editing, high CPU performance, and the ability to load native instrument components. The future of MakePad includes an open-source release, a design tool, and support for importing 3D models.
Extending Unity WebGL With Javascript
JS GameDev Summit 2022JS GameDev Summit 2022
32 min
Extending Unity WebGL With Javascript
Top Content
Unity targets over 25 platforms and technologies, including desktop, mobile, and virtual reality. They use Emscripten to compile the engine and game logic into WebAssembly for web development. Unity can be extended with plugins to access browser features like WebXR's augmented reality mode. The speaker demonstrates intercepting Unity's calls to the browser to modify its behavior. Unity is actively working on mobile support for web export and improving documentation for extending Unity with web plugins.