-
Notifications
You must be signed in to change notification settings - Fork 229
Closed
Labels
area-coreRelated to some core parts of alphaTabRelated to some core parts of alphaTabplatform-javascriptRelated to the JavaScript version of alphaTabRelated to the JavaScript version of alphaTabstate-acceptedThis is a valid topic to work on.This is a valid topic to work on.
Description
Is there an existing issue for this?
- I have searched the existing issues
Current Behavior
I've just installed the latest alpha (1.4.0-alpha.1080 at this point), and I'm really happy you included the JSON version of the configuration types.
The issue I'm facing, is that the types are not exposed. So while type checking/autocomplete works fine for inline api-creation:
new AlphaTabApi(dom, { ... })The type itself cannot be reused without extracting it first:
import { AlphaTabApi } from '@coderline/alphatab'
// Get the constructor type which is a union
type Settings = ConstructorParameters<typeof AlphaTabApi>[1]
// Extract the JSON type with some ts magic
type ExtractJsonType<T> = T extends { fillFromJson: any } ? never : T
type SettingsJson = ExtractJsonType<Settings>
// Extract the necessary types from the Json type
type CoreSettingsJson = Exclude<SettingsJson['core'], undefined>
type PlayerSettingsJson = Exclude<SettingsJson['player'], undefined>
type DisplaySettingsJson = Exclude<SettingsJson['display'], undefined>Expected Behavior
import { SettingsJson, CoreSettingsJson, DisplaySettingsJson, NotationSettingsJson, ImporterSettingsJson, PlayerSettingsJson } from '@coderline/alphatab'or at least:
import { SettingsJson } from '@coderline/alphatab'Steps To Reproduce
Link to jsFiddle, CodePen, Project
No response
Found in Version
1.4 (alpha)
Platform
Web
Environment
- **OS**: Win 11
- **Browser**: not relevant
- **.net Version**: not relevantAnything else?
No response
Metadata
Metadata
Assignees
Labels
area-coreRelated to some core parts of alphaTabRelated to some core parts of alphaTabplatform-javascriptRelated to the JavaScript version of alphaTabRelated to the JavaScript version of alphaTabstate-acceptedThis is a valid topic to work on.This is a valid topic to work on.