generated from tc39/template-for-proposals
-
Notifications
You must be signed in to change notification settings - Fork 12
Open
Description
import source mod from './foo.dope'
if (mod instanceof WebAssembly.Module) console.log('a')
else if (mod instanceof ModuleSource) console.log('b')Does this log "a" or "b"?
It seems like import attributes are required, otherwise if they are not, then that begs the question as to why import attributes are even required in the first place for importing anything other than JavaScript.
This seems to make sense:
import source mod from './foo.dope'
if (mod instanceof WebAssembly.Module) console.log('a')
else if (mod instanceof ModuleSource) console.log('b') // THIS ONEimport source mod from './foo.dope' with { type: "wasm" }
if (mod instanceof WebAssembly.Module) console.log('a') // THIS ONE
else if (mod instanceof ModuleSource) console.log('b')Otherwise without import attributes, we are saying that it is ok to determine the type of a module based on the file name, which we've already determined we do not want to do in the import attributes spec and that's why with { type: "whatever" } is required.
Seems there is a contradiction.
Metadata
Metadata
Assignees
Labels
No labels