-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Labels
Description
Describe the Bug
AddTrack
is defined as a union of Track
and url
and artwork
properties which are meant to be string | ResourceObject
. However because these properties exist in Track
and are defined as string
only, the effective type AddTrack["url"]
and AddTrack["artwork"]
is also string
.
Code To Reproduce
const url: ResourceObject = require("something.mp3");
const artwork: ResourceObject = require("something.jpg");
const track: AddTrack = {
url, // error: Type 'number' is not assignable to type 'string'
artwork, // error: Type 'number' is not assignable to type 'string'
}
How I can Help
The correct definition for AddTrack
should omit these properties from Track
first, like so:
export type AddTrack = Omit<Track, "url" | "artwork"> & {
url: string | ResourceObject;
artwork?: string | ResourceObject;
};