Skip to content

Missing type re-exports from spessasynth_core forces users to use any/ts-expect-error or transitive imports #31

@sahaj-b

Description

@sahaj-b

Duplicated issue check

  • I confirm that I have searched the existing issues

package version

4.2.9

Description

spessasynth_lib doesn't re-export several core TypeScript types that are exposed on its public API methods.
Because of this, we can't type the data coming out of or going into spessasynth_lib without either:

  1. using@ts-expect-error or any everywhere.
  2. importing from the transitive dependency spessasynth_core (which breaks in strict package managers like pnpm).

Expected Behavior

spessasynth_lib should export types which are being used in its public API, eg: BasicMIDI, MIDIData, MIDITrack, MIDIMessage, MIDIController, etc

Reproduction steps

  1. Initialize a TypeScript project:
    pnpm init
    pnpm add spessasynth_lib
  2. Create an index.ts file and attempt to use basic API features:
import { WorkletSynthesizer } from "spessasynth_lib";

declare const ctx: AudioContext;
const synth = new WorkletSynthesizer(ctx);

function changeCC(cc: number) {
	// TS Error: expecting MIDIController, but passed number. MIDIController is not exported by `spessasynth_lib`
	synth.controllerChange(0, cc, 127);
}
  1. Run tsc index.ts or check the lsp. Error is thrown: `index.ts:8:28 - error TS2345: Argument of type 'number' is not assignable to parameter of type 'MIDIController'.

Browser Engine

Chromium (Chrome, Edge, Brave, Opera, etc.)

Additional info

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions