Skip to content

Commit

Permalink
fix: typing
Browse files Browse the repository at this point in the history
  • Loading branch information
bart-krakowski committed Jul 21, 2022
1 parent 1f7db10 commit 69db212
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions packages/fiber/tests/setupTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,21 @@ import * as THREE from 'three'
import { extend } from '../src'

// Polyfills WebGL canvas
HTMLCanvasElement.prototype.getContext = function () {
return createWebGLContext(this)
function getContext(contextId: '2d', options?: CanvasRenderingContext2DSettings): CanvasRenderingContext2D | null
function getContext(
contextId: 'bitmaprenderer',
options?: ImageBitmapRenderingContextSettings,
): ImageBitmapRenderingContext | null
function getContext(contextId: 'webgl', options?: WebGLContextAttributes): WebGLRenderingContext | null
function getContext(contextId: 'webgl2', options?: WebGLContextAttributes): WebGL2RenderingContext | null
function getContext(contextId: string): RenderingContext | null {
if (contextId === 'webgl' || contextId === 'webgl2') {
return createWebGLContext(this)
}
return null
}

HTMLCanvasElement.prototype.getContext = getContext

// Extend catalogue for render API in tests
extend(THREE)

0 comments on commit 69db212

Please sign in to comment.