Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(types): suppress errors with @ts-expect-error directive instead of @ts-ignore #3259

Merged
merged 7 commits into from
May 8, 2024
4 changes: 2 additions & 2 deletions example/src/demos/Lines.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function useDrag(onDrag: any, onEnd: any) {
setActive(true)
toggle(false)
event.stopPropagation()
// @ts-ignore
// @ts-expect-error
event.target.setPointerCapture(event.pointerId)
}

Expand All @@ -41,7 +41,7 @@ function useDrag(onDrag: any, onEnd: any) {
setActive(false)
toggle(true)
event.stopPropagation()
// @ts-ignore
// @ts-expect-error
event.target.releasePointerCapture(event.pointerId)
if (onEnd) onEnd()
}
Expand Down
4 changes: 2 additions & 2 deletions packages/fiber/src/core/renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ function createRenderer<TCanvas>(_roots: Map<TCanvas, Root>, _getEventPriority?:
detach(parentInstance, child, child.__r3f.attach)
} else if (child.isObject3D && parentInstance.isObject3D) {
parentInstance.remove(child)
// @ts-ignore
// @ts-expect-error
// Remove interactivity on the initial root
if (child.__r3f?.root) {
removeInteractivity(findInitialRoot(child), child as unknown as THREE.Object3D)
Expand Down Expand Up @@ -426,7 +426,7 @@ function createRenderer<TCanvas>(_roots: Map<TCanvas, Root>, _getEventPriority?:
hideTextInstance: handleTextInstance,
unhideTextInstance: handleTextInstance,
// https://github.com/pmndrs/react-three-fiber/pull/2360#discussion_r916356874
// @ts-ignore
// @ts-expect-error
getCurrentEventPriority: () => (_getEventPriority ? _getEventPriority() : DefaultEventPriority),
beforeActiveInstanceBlur: () => {},
afterActiveInstanceBlur: () => {},
Expand Down
2 changes: 1 addition & 1 deletion packages/fiber/src/core/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ export function applyProps(instance: Instance, data: InstanceProps | DiffSet) {
// create a blank slate of the instance and copy the particular parameter.
let ctor = DEFAULTS.get(currentInstance.constructor)
if (!ctor) {
// @ts-ignore
// @ts-expect-error
ctor = new currentInstance.constructor()
DEFAULTS.set(currentInstance.constructor, ctor)
}
Expand Down
2 changes: 1 addition & 1 deletion packages/fiber/src/native/polyfills.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ export function polyfills() {
texture.needsUpdate = true

// Force non-DOM upload for EXGL texImage2D
// @ts-ignore
// @ts-expect-error
texture.isDataTexture = true

onLoad?.(texture)
Expand Down
8 changes: 4 additions & 4 deletions packages/fiber/tests/core/renderer.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -746,9 +746,9 @@ describe('renderer', () => {
expect(gl.toneMapping).toBe(THREE.ACESFilmicToneMapping)
expect(texture.encoding).toBe(sRGBEncoding)

// @ts-ignore
// @ts-expect-error
THREE.WebGLRenderer.prototype.outputColorSpace ??= ''
// @ts-ignore
// @ts-expect-error
THREE.Texture.prototype.colorSpace ??= ''

await act(async () =>
Expand Down Expand Up @@ -780,9 +780,9 @@ describe('renderer', () => {
expect(gl.outputColorSpace).toBe(SRGBColorSpace)
expect(texture.colorSpace).toBe(SRGBColorSpace)

// @ts-ignore
// @ts-expect-error
delete THREE.WebGLRenderer.prototype.outputColorSpace
// @ts-ignore
// @ts-expect-error
delete THREE.Texture.prototype.colorSpace
})

Expand Down
4 changes: 2 additions & 2 deletions packages/test-renderer/src/createTestCanvas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ export const createCanvas = ({ beforeReturn, width = 1280, height = 800 }: Creat
beforeReturn?.(canvas)

class WebGLRenderingContext extends WebGL2RenderingContext {}
// @ts-ignore
// @ts-expect-error
globalThis.WebGLRenderingContext ??= WebGLRenderingContext
// @ts-ignore
// @ts-expect-error
globalThis.WebGL2RenderingContext ??= WebGL2RenderingContext

return canvas
Expand Down