Skip to content

opensheetmusicdisplay/osmd-types-player

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

osmd-types-player

Rolled up type Definitions for the OSMD Audio Player (single file).
The default build output of the typescript compiler produces many nested files and folders,
but here the definitions are rolled up into a single file, using Microsoft's api-extractor.

Code for the OSMD Audio Player is not public, as it's currently sponsor-exclusive,
but having public type declarations is okay.

How to use the types

  • add osmd-types-player as a dependency in package.json:
  "dependencies": {
    "osmd-types-player": "git+https://github.com/opensheetmusicdisplay/osmd-types-player.git#ff8081b60e32f80cb1d7a5746cfd0e66f769953e"
  }

(the hash at the end is the commit hash, so update this to use the latest commit)

  • in tsconfig.json, add this:
    "typeRoots": [
      "node_modules/@types",
      "node_modules/osmd-types-player",
    ],
  • (optional) add "opensheetmusicdisplay": "file:opensheetmusicdisplay.min.js" as a dependency (this is the audio player build)
  • npm install
  • now you can import types, e.g.:
import type { IOSMDOptions } from 'opensheetmusicdisplay';
import { PlaybackManager } from 'opensheetmusicdisplay';

How to generate/update the types

  • checkout the osmd audio player repository
  • run npm install if necessary
  • run npm run build if necessary (to get up to date type definitions)
  • npm i -g @microsoft/api-extractor
  • api-extractor run --local --verbose
  • rolled up definitions will be in build/opensheetmusicdisplay.d.ts
  • for api-extractor details, see here
the alternative dts-bundle seems to create erroneous syntax
  • checkout the osmd audio player repository
  • run npm install if necessary
  • run npm run build if necessary (to get up to date type definitions)
  • run npm install -g dts-bundle if necessary (will install this package globally)
  • cd build/dist/src
  • dts-bundle --name opensheetmusicdisplay --main .\index.d.ts
  • rolled up definitions will be in build/dist/src/

About

Type Definitions for the OSMD Audio Player

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published