Skip to content

Commit d774ede

Browse files
authored
fix: message channel error (pmndrs#1357)
1 parent a3c8b4b commit d774ede

File tree

4 files changed

+14
-1
lines changed

4 files changed

+14
-1
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
"@rollup/plugin-commonjs": "^11.1.0",
6262
"@rollup/plugin-node-resolve": "^7.1.3",
6363
"@types/jest": "^24.0.13",
64+
"@types/node": "^14.14.35",
6465
"@types/react": "^16.8.19",
6566
"build-if-changed": "^1.5.0",
6667
"chalk": "^2.4.2",

packages/core/src/hooks/useTransition.test.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,13 @@ import { RenderResult, render } from '@testing-library/react'
33
import { toArray } from '@react-spring/shared'
44
import { TransitionFn, UseTransitionProps } from '../types'
55
import { useTransition } from './useTransition'
6+
import { MessageChannel as MessageChannelPolyfill } from 'worker_threads'
67

8+
beforeAll(() => {
9+
if (!window.MessageChannel) {
10+
window.MessageChannel = (MessageChannelPolyfill as unknown) as typeof window.MessageChannel
11+
}
12+
})
713
describe('useTransition', () => {
814
let transition: TransitionFn
915
let rendered: any[]

packages/core/tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"baseUrl": ".",
55
"forceConsistentCasingInFileNames": true,
66
"jsx": "react",
7-
"lib": ["es2017"],
7+
"lib": ["es2017", "DOM"],
88
"moduleResolution": "node",
99
"noErrorTruncation": true,
1010
"noEmitOnError": true,
@@ -15,6 +15,7 @@
1515
"sourceMap": true,
1616
"strict": true,
1717
"target": "esnext",
18+
"module": "ESNext",
1819
"typeRoots": ["../../node_modules/@types", "../../@types"]
1920
}
2021
}

yarn.lock

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2559,6 +2559,11 @@
25592559
resolved "https://registry.npmjs.org/@types/node/-/node-14.14.14.tgz#f7fd5f3cc8521301119f63910f0fb965c7d761ae"
25602560
integrity sha512-UHnOPWVWV1z+VV8k6L1HhG7UbGBgIdghqF3l9Ny9ApPghbjICXkUJSd/b9gOgQfjM1r+37cipdw/HJ3F6ICEnQ==
25612561

2562+
"@types/node@^14.14.35":
2563+
version "14.14.35"
2564+
resolved "https://registry.yarnpkg.com/@types/node/-/node-14.14.35.tgz#42c953a4e2b18ab931f72477e7012172f4ffa313"
2565+
integrity sha512-Lt+wj8NVPx0zUmUwumiVXapmaLUcAk3yPuHCFVXras9k5VT9TdhJqKqGVUQCD60OTMCl0qxJ57OiTL0Mic3Iag==
2566+
25622567
"@types/normalize-package-data@^2.4.0":
25632568
version "2.4.0"
25642569
resolved "https://registry.npmjs.org/@types/normalize-package-data/-/normalize-package-data-2.4.0.tgz#e486d0d97396d79beedd0a6e33f4534ff6b4973e"

0 commit comments

Comments
 (0)