diff --git a/src/examples/compute/compute-particles-fluid/FluidParticles.tsx b/src/examples/compute/compute-particles-fluid/FluidParticles.tsx index c3e6c54..a7baa05 100644 --- a/src/examples/compute/compute-particles-fluid/FluidParticles.tsx +++ b/src/examples/compute/compute-particles-fluid/FluidParticles.tsx @@ -162,7 +162,7 @@ export function FluidParticles() { // Fixed-point codec for the atomic grid. Cast: struct member access types as a bare // `Node`, which has no fluent surface (typed-TSL gap, AGENTS.md B10/B11 cast family). const encodeFixedPoint = (value: Node<'float'>) => int(value.mul(FIXED_POINT_MULTIPLIER)); - const readCell = (field: Node) => float(atomicLoad(field as unknown as Node<'int'>)).div(FIXED_POINT_MULTIPLIER); + const readCell = (field: Node) => float(atomicLoad(field as Node<'int'>)).div(FIXED_POINT_MULTIPLIER); // Cast: @types/three's Loop overloads stop at two ranges and both are handed to // the callback as `{ i, j }`. The runtime takes any number of ranges and names @@ -222,9 +222,9 @@ export function FluidParticles() { const element = particleBuffer.element(instanceIndex); // Casts: struct member access types as a bare `Node`, which has no fluent vec // surface (typed-TSL gap, AGENTS.md B10/B11 cast family). - const particlePosition = (element.get('position') as unknown as Node<'vec3'>).toConst(); + const particlePosition = (element.get('position') as Node<'vec3'>).toConst(); const particleVelocity = (element.get('velocity') as unknown as Node<'vec3'>).toConst(); - const affineMomentum = (element.get('C') as unknown as Node<'mat3'>).toConst(); + const affineMomentum = (element.get('C') as Node<'mat3'>).toConst(); const gridPosition = particlePosition.mul(GRID_SIZE).toVar(); const cellIndex = ivec3(gridPosition).sub(1).toConst(); @@ -267,7 +267,7 @@ export function FluidParticles() { const volume = float(1).div(density); const pressure = max(0, pow(density.div(REST_DENSITY), 5).sub(1).mul(STIFFNESS)).toConst(); const stress = mat3(pressure.negate(), 0, 0, 0, pressure.negate(), 0, 0, 0, pressure.negate()).toVar(); - const dudv = (element.get('C') as unknown as Node<'mat3'>).toConst(); + const dudv = (element.get('C') as Node<'mat3'>).toConst(); const strain = dudv.add(dudv.transpose()); stress.addAssign(strain.mul(DYNAMIC_VISCOSITY)); const eq16Term0 = volume.mul(-4).mul(stress).mul(uDelta); @@ -355,7 +355,7 @@ export function FluidParticles() { particleVelocity.addAssign(weightedVelocity); }); - (element.get('C') as unknown as Node<'mat3'>).assign(B.mul(4)); + (element.get('C') as Node<'mat3'>).assign(B.mul(4)); particleVelocity.addAssign(vec3(0, GRAVITY, 0).mul(uDelta)); // Grid units -> unit cube, so the rest of this runs in the particle's own space. @@ -379,7 +379,7 @@ export function FluidParticles() { particleVelocity.mulAssign(GRID_SIZE); (element.get('position') as unknown as Node<'vec3'>).assign(particlePosition); - (element.get('velocity') as unknown as Node<'vec3'>).assign(particleVelocity); + (element.get('velocity') as Node<'vec3'>).assign(particleVelocity); })().compute(DEFAULT_PARTICLE_COUNT, [WORKGROUP_SIZE, 1, 1]); return { diff --git a/src/examples/compute/compute-points.tsx b/src/examples/compute/compute-points.tsx index 9059c5b..e005e93 100644 --- a/src/examples/compute/compute-points.tsx +++ b/src/examples/compute/compute-points.tsx @@ -174,7 +174,7 @@ function PointsField() { const points = pointsRef.current; if (!points) return; points.geometry.drawRange.count = 1; - (points as unknown as { count: number }).count = PARTICLE_COUNT; + (points as { count: number }).count = PARTICLE_COUNT; }, []); return ( diff --git a/src/examples/compute/compute-rasterizer-ibl/rasterizerKernels.ts b/src/examples/compute/compute-rasterizer-ibl/rasterizerKernels.ts index c33b008..5526f7d 100644 --- a/src/examples/compute/compute-rasterizer-ibl/rasterizerKernels.ts +++ b/src/examples/compute/compute-rasterizer-ibl/rasterizerKernels.ts @@ -55,7 +55,7 @@ function namedLoop( params: { name: K; type: T; start: Node | number; end: Node | number; condition: string }, body: (inputs: Record>) => void, ) { - (Loop as unknown as (loopParams: typeof params, loopBody: typeof body) => void)(params, body); + (Loop as (loopParams: typeof params, loopBody: typeof body) => void)(params, body); } /** Signed screen-space area of a triangle — also the barycentric weight generator. */ diff --git a/src/examples/compute/compute-rasterizer/Rasterizer.tsx b/src/examples/compute/compute-rasterizer/Rasterizer.tsx index e99e826..20b760d 100644 --- a/src/examples/compute/compute-rasterizer/Rasterizer.tsx +++ b/src/examples/compute/compute-rasterizer/Rasterizer.tsx @@ -107,7 +107,7 @@ function namedLoop( params: { name: K; type: T; start: Node | number; end: Node | number; condition: string }, body: (inputs: Record>) => void, ) { - (Loop as unknown as (loopParams: typeof params, loopBody: typeof body) => void)(params, body); + (Loop as (loopParams: typeof params, loopBody: typeof body) => void)(params, body); } // Signed area of a triangle in screen space — also the barycentric weight generator. diff --git a/src/examples/compute/compute-texture-3d.tsx b/src/examples/compute/compute-texture-3d.tsx index db33f5a..1fe6da8 100644 --- a/src/examples/compute/compute-texture-3d.tsx +++ b/src/examples/compute/compute-texture-3d.tsx @@ -89,7 +89,7 @@ function CloudVolume() { const tex = new Storage3DTexture(GRID_SIZE, GRID_SIZE, GRID_SIZE); tex.generateMipmaps = false; tex.name = 'cloud'; - return tex as unknown as StorageTexture; + return tex as StorageTexture; }); // ROOT-LEVEL useNodes on purpose (UPSTREAM.md B16): a scoped call would name entries diff --git a/src/examples/compute/compute-water/Water.tsx b/src/examples/compute/compute-water/Water.tsx index 2fdc899..2b75ddd 100644 --- a/src/examples/compute/compute-water/Water.tsx +++ b/src/examples/compute/compute-water/Water.tsx @@ -272,7 +272,7 @@ export function Water({ controlsRef }: WaterProps) { const duckElement = waterDuckData.element(instanceIndex); // Casts: struct member access (`.get`) types as bare `Node` — the fluent // vec surface doesn't resolve through it (typed-TSL gap, B10 cast family). - const instancePosition = (duckElement.get('position') as unknown as Node<'vec3'>).toVar(); + const instancePosition = (duckElement.get('position') as Node<'vec3'>).toVar(); const velocity = (duckElement.get('velocity') as unknown as Node<'vec2'>).toVar(); // Simulation-grid texel under the duck. @@ -316,14 +316,14 @@ export function Water({ controlsRef }: WaterProps) { velocity.y.mulAssign(bounceDamping); }); - (duckElement.get('position') as unknown as Node<'vec3'>).assign(instancePosition); + (duckElement.get('position') as Node<'vec3'>).assign(instancePosition); (duckElement.get('velocity') as unknown as Node<'vec2'>).assign(velocity); })().compute(NUM_DUCKS); // Instance placement for the duck mesh — offset the source geometry by the // struct buffer's live position (same B10-family cast as above). const duckPositionNode = Fn(() => { - const instancePosition = waterDuckData.element(instanceIndex).get('position') as unknown as Node<'vec3'>; + const instancePosition = waterDuckData.element(instanceIndex).get('position') as Node<'vec3'>; return positionLocal.add(instancePosition); })(); diff --git a/src/examples/loaders/loader-materialx/GridFloor.tsx b/src/examples/loaders/loader-materialx/GridFloor.tsx index 23405d6..ddf7ff8 100644 --- a/src/examples/loaders/loader-materialx/GridFloor.tsx +++ b/src/examples/loaders/loader-materialx/GridFloor.tsx @@ -8,7 +8,7 @@ import type { Node } from 'three/webgpu'; // default-value typing — AGENTS.md B10. `coord` is always called with a vec2 // (`positionWorld.xz`); regain that so `.x`/`.y` swizzles typecheck below. const grid = Fn(([coordIn, lineWidth = float(0.01), dotSize = float(0.03)]) => { - const coord = coordIn as unknown as Node<'vec2'>; + const coord = coordIn as Node<'vec2'>; const g = fract(coord); const fw = fwidth(coord); const gx = abs(g.x.sub(0.5)); diff --git a/src/examples/postprocessing/postprocessing-anamorphic.tsx b/src/examples/postprocessing/postprocessing-anamorphic.tsx index eb91b87..4be36e7 100644 --- a/src/examples/postprocessing/postprocessing-anamorphic.tsx +++ b/src/examples/postprocessing/postprocessing-anamorphic.tsx @@ -177,7 +177,7 @@ function PostFX() { // `highPassFn`'s declared type is `(params) => void`; the runtime (and the // addon's own default) returns a Node — documented @types gap, cast once. - bloomPass.highPassFn = anamorphicHighPass as unknown as typeof bloomPass.highPassFn; + bloomPass.highPassFn = anamorphicHighPass as typeof bloomPass.highPassFn; renderPipeline.outputNode = scenePassColor.add(bloomPass.mul(uniforms.tintColor)); }); diff --git a/src/examples/scene/portal/PortalModels.tsx b/src/examples/scene/portal/PortalModels.tsx index 311853e..94d9ac1 100644 --- a/src/examples/scene/portal/PortalModels.tsx +++ b/src/examples/scene/portal/PortalModels.tsx @@ -55,7 +55,7 @@ export function PortalGhost() { // the original's plain `material.colorNode = ...` on a classic material works at // all. `@types/three` only declares `colorNode` on the Node-suffixed classes // (same duck-typed-property pattern as `scene.fogNode`/`backgroundNode`). - (material as unknown as { colorNode: Node | null }).colorNode = colorNode; + (material as { colorNode: Node | null }).colorNode = colorNode; material.wireframe = true; mesh.material = material; }); diff --git a/src/examples/shadows/shadowmap-opacity.tsx b/src/examples/shadows/shadowmap-opacity.tsx index fa743f4..c8735ab 100644 --- a/src/examples/shadows/shadowmap-opacity.tsx +++ b/src/examples/shadows/shadowmap-opacity.tsx @@ -110,7 +110,7 @@ function DragonScene() { // Duck-typed cast (AGENTS.md B11 family): GLTFLoader hands back a classic // MeshPhysicalMaterial, but attenuationColor/castShadowNode both read fine at // runtime regardless of the material's declared TS type. - const dragonMaterial = dragon.material as unknown as MeshPhysicalNodeMaterial; + const dragonMaterial = dragon.material as MeshPhysicalNodeMaterial; const dragon2 = dragon.clone(); dragon2.material = dragonMaterial.clone(); diff --git a/src/examples/tsl/tsl-vfx-tornado/Tornado.tsx b/src/examples/tsl/tsl-vfx-tornado/Tornado.tsx index e3e1e8b..01f30ab 100644 --- a/src/examples/tsl/tsl-vfx-tornado/Tornado.tsx +++ b/src/examples/tsl/tsl-vfx-tornado/Tornado.tsx @@ -82,10 +82,10 @@ export function Tornado() { const toRadialUv = Fn(([uvIn, multiplierIn, rotationIn, offsetIn]) => { // Fn's destructured params come back as bare `ShaderNodeObject` — too // loose for the swizzles/typed math below (three-side gap, UPSTREAM.md B10). - const uvInput = uvIn as unknown as Node<'vec2'>; - const multiplier = multiplierIn as unknown as Node<'vec2'>; - const rotation = rotationIn as unknown as Node<'float'>; - const offset = offsetIn as unknown as Node<'float'>; + const uvInput = uvIn as Node<'vec2'>; + const multiplier = multiplierIn as Node<'vec2'>; + const rotation = rotationIn as Node<'float'>; + const offset = offsetIn as Node<'float'>; const centeredUv = vec2(uvInput).sub(0.5).toVar(); const distanceToCenter = centeredUv.length(); @@ -101,8 +101,8 @@ export function Tornado() { // Shear the UV space — turns straight scrolling noise into diagonal streaks // (the "wind-dragged" look on the cylinders). const toSkewedUv = Fn(([uvIn, skewIn]) => { - const uvInput = uvIn as unknown as Node<'vec2'>; // B10 cast, as above - const skew = skewIn as unknown as Node<'vec2'>; + const uvInput = uvIn as Node<'vec2'>; // B10 cast, as above + const skew = skewIn as Node<'vec2'>; return vec2(uvInput.x.add(uvInput.y.mul(skew.x)), uvInput.y.add(uvInput.x.mul(skew.y))); }); @@ -110,11 +110,11 @@ export function Tornado() { // The funnel: re-radius every cylinder vertex along a parabola of its height, // plus a sine turbulence wobble that climbs over time. const twistedCylinder = Fn(([positionIn, strengthIn, offsetIn, amplitudeIn, timeIn]) => { - const position = positionIn as unknown as Node<'vec3'>; // B10 casts, as above - const strength = strengthIn as unknown as Node<'float'>; - const offset = offsetIn as unknown as Node<'float'>; - const amplitude = amplitudeIn as unknown as Node<'float'>; - const t = timeIn as unknown as Node<'float'>; + const position = positionIn as Node<'vec3'>; // B10 casts, as above + const strength = strengthIn as Node<'float'>; + const offset = offsetIn as Node<'float'>; + const amplitude = amplitudeIn as Node<'float'>; + const t = timeIn as Node<'float'>; const angle = atan(position.z, position.x).toVar(); const elevation = position.y; diff --git a/src/examples/volume/volume-fire/VolumeFire.tsx b/src/examples/volume/volume-fire/VolumeFire.tsx index 680fef2..310f79a 100644 --- a/src/examples/volume/volume-fire/VolumeFire.tsx +++ b/src/examples/volume/volume-fire/VolumeFire.tsx @@ -66,7 +66,7 @@ function createStorage3D(wrap: Wrapping = ClampToEdgeWrapping): StorageTexture { texture.wrapS = wrap; texture.wrapT = wrap; texture.wrapR = wrap; - return texture as unknown as StorageTexture; + return texture as StorageTexture; } export function VolumeFire({ cameraControlsRef }: { cameraControlsRef: RefObject }) { diff --git a/src/utils/resumeAudioContext.ts b/src/utils/resumeAudioContext.ts index 162248c..d2213ff 100644 --- a/src/utils/resumeAudioContext.ts +++ b/src/utils/resumeAudioContext.ts @@ -12,5 +12,5 @@ import { AudioContext as ThreeAudioContext } from 'three/webgpu'; export function resumeAudioContext() { - return (ThreeAudioContext.getContext() as unknown as globalThis.AudioContext).resume(); + return (ThreeAudioContext.getContext() as globalThis.AudioContext).resume(); }