Please typescript by double checking type
This commit is contained in:
parent
2e65d20c39
commit
f233394d0d
1 changed files with 7 additions and 1 deletions
|
|
@ -288,7 +288,13 @@ const forge = () => {
|
|||
}
|
||||
await new Promise(res => {
|
||||
currentGun.on('message', msg => {
|
||||
if (msg.type === 'init') {
|
||||
if (typeof msg !== 'object') {
|
||||
throw new Error(`msg.type !== object`)
|
||||
}
|
||||
|
||||
const message = /** @type {{type: string}} */ (msg)
|
||||
|
||||
if (message.type === 'init') {
|
||||
// @ts-ignore
|
||||
res()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue