Please typescript by double checking type

This commit is contained in:
Daniel Lugo 2022-01-29 16:37:03 -05:00
parent 2e65d20c39
commit f233394d0d

View file

@ -288,7 +288,13 @@ const forge = () => {
} }
await new Promise(res => { await new Promise(res => {
currentGun.on('message', msg => { 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 // @ts-ignore
res() res()
} }