You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, the renderer function returned by chordRendererFactory is always of the type (chord: Chord) => string.
However, if printer: "raw" is given as an option to the factory, the returned function actually returns a Chord.
Function overloads work for fixing it, by discriminating on the type of the options object.
Example:
typePrinterRaw={printer: "raw"}// The order is important: the first matching overload is used, hence the more specific one has to come first.declarefunctionchordRendererFactory(configuration: RendererConfiguration&PrinterRaw): (chord: CSChord)=>CSChorddeclarefunctionchordRendererFactory(configuration?: RendererConfiguration): (chord: CSChord)=>string
By the source code, I believe this issue exists with JSDoc-supplied types as well.
The text was updated successfully, but these errors were encountered:
Currently, the renderer function returned by
chordRendererFactory
is always of the type(chord: Chord) => string
.However, if
printer: "raw"
is given as an option to the factory, the returned function actually returns aChord
.Function overloads work for fixing it, by discriminating on the type of the options object.
Example:
By the source code, I believe this issue exists with JSDoc-supplied types as well.
The text was updated successfully, but these errors were encountered: