Skip to content

new readonly modifiers on Promise.all break lyricist in DT #33559

@sandersn

Description

@sandersn

Broken by #33057

  1. clone dt
  2. cd ~/dt/types/lyricist
  3. tsl
  4. error on `const songsByArtist: SongByArtist[] = results[5];
Promise
    .all([
        lyricist.album(1, { fetchTracklist: true, textFormat: LyricistTextFormat.PLAIN }),
        lyricist.artist(1, { textFormat: LyricistTextFormat.PLAIN }),
        lyricist.artistByName('any_artist', { textFormat: LyricistTextFormat.PLAIN }),
        lyricist.search('any_song'),
        lyricist.song(1, { fetchLyrics: true, textFormat: LyricistTextFormat.PLAIN }),
        lyricist.songsByArtist(1, { page: 1, perPage: 10, sort: 'asc' }),
    ])
    .then((results) => {
        const album: Album = results[0];
        const artist: Artist = results[1];
        const artistByName: Artist = results[2];
        const searchResult: SearchResult[] = results[3];
        const song: Song = results[4];
        const songsByArtist: SongByArtist[] = results[5];

        console.log('album', album.name);
        console.log('artist', artist.name);
        console.log('artistByName', artistByName.name);
        console.log('searchResult length', searchResult.length);
        console.log('song', song.title);
        console.log('songsByArtist length', songsByArtist.length);
    });

Expected behavior:
No error, and results[5]: SongByArtist[]

Actual behavior:
Error, and results[5]: SearchResult[]

The two types are VERY similar, although I'm not sure that's relevant. My guess is that it's a very subtle inference problem.

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptFix AvailableA PR has been opened for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions