-
-
Notifications
You must be signed in to change notification settings - Fork 29
Open
Description
EDIT: I do not want to use any
instead of unknown
here
Sorry if this seems trivial for most, but I cant get types from this package to work (or show up in VSCode even)
In my nuxt application, I want a reactive output like so:
// /composables/useMidi.ts
export function useMidi() {
const jzzOutput = useState<unknown>('jzz-output', () => null)
...
onMounted(() => {
jzzOutput.value = JZZ().openMidiOut(deviceName)
.or(() => console.log(`useMidi: could not open device "${deviceName}"`))
.then(() => console.log(`useMidi: successfully opened device "${deviceName}"`))
})
...
function playNote(note = 'C4') {
jzzOutput.value.noteOn(CHANNEL, note, 127).wait(500).noteOff(CHANNEL, note)
}
The ts error I'm obviously getting in the playNote function is:
Property 'noteOn' does not exist on type '{}'
So now I want to replace unknown
at the beginning of the composable with the correct type from jzz/index.d.ts
, but I can't figure out how.
What I've tried
- I tried using the main import
JZZ
withtypeof
etc. - experimented with
import type JZZTypes from 'jzz'
(also `from 'jzz/index.d.ts') - Added
'jzz'
to ts.config.tscompilerOptoins.types
Metadata
Metadata
Assignees
Labels
No labels