Replies: 2 comments 1 reply
-
The solution is to install import { Scale, get } from "@tonaljs/scale";
const myScale: Scale = { ... }
console.log(myScale);
console.log(get("C major")); // <= just a reminder the function from packages can be imported and used without namespace I never realized those types were not exported from main |
Beta Was this translation helpful? Give feedback.
1 reply
-
In the new version you can import types directly ( import { Interval, IntervalType, Note, NoteType } from "tonal";
const note: NoteType = Note.get("C4");
const interval: IntervalType = Interval.get("4P"); |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, I'm not super familiar with TypeScript but using it with Tonal in a Vue project.
I'm a bit confused how to access types such as Scale (ie, the return value of
Scale.get()
), because of the name collision with the module name.import { Scale } from 'tonal'
This gives us
Scale
, the whole module.There's also the type,
Scale
declared like this inpackages/scale.ts
:But I can't figure out how to import that
Scale
type in order to declare a variable of typeScale
.These don't seem to work:
Beta Was this translation helpful? Give feedback.
All reactions