"Expression produces a union type that is too complex to represent" when using interfaces with large number of params for filtering and narrowing down certain keys #57863
Labels
Bug
A bug in TypeScript
Fix Available
A PR has been opened for this issue
Recent Regression
This is a new regression just found in the last major/minor version of TypeScript.
Milestone
π Search Terms
Expression produces a union type that is too complex to represent, 2590, ts2590
π Version & Regression Information
β― Playground Link
https://www.typescriptlang.org/play?ts=5.4.2#code/KYDwDg9gTgLgBASwHY2FAZgQwMbDgVTABNNU4BvAKDhrgFdjTgB9BIgLjiToFsAjNAG5K1Wj2ABnCZgDmwAPydyccVNnBOEmFGQy4AX2G04wIglRFmq6XMUUTZi1ck2NcLTqR7DomtgAWmEhIwAA2zJBadsoBQSHhkTCa2roGRrSm5qbMscFhERBRSg5ZlrnxBVrJnt7pNNbqzFDAODAIEEjRKi6Nza3tSNWpPsYNck0t2G0dORB0KF1jLH1TA7PzSe4pXmm+iEihyCwAjnRoAJ5dyIchzKcXQzsjtAGFwEisB0cTEnShMF1XhJ3p8bstJH9Nh5hnU4NhMKFQnwcABrO5nKCXYrwxHI7Bo+6Yx61PYSfwIMBgXToi5dMkUqleGlErY1XbGMDNHL+YD4uYwZlY+yclgBXko-mC4ns2iQRFdOWhaXPGiK5hBCQAdzQCogiPVSC1aGVsJ4525pGc-B1xTNFoF4mtUBNe1iDuATsBgXdTpdxjdzAAVhBkBN7kV7AHg6HmuGodsSf7vcw+BBCgDscnU+m-bRmjwIAA3bIB7MR5T5oslrNpqqsmGUfQiGDnMB4ABiCH+aHb81WHQAPPgTCBUEgiBICIxUAAaOAANRHY4nBAAfHAALxwAAUDE4+AAlJv1wxEJP58JKKBILA4Og+9MkCpSAFO92oEOl+8V4QSLO4AAil+46Tm+qBQABGLnKu257OgXbgZwQEAD6AQA2gAujOlAHpwYE9g+AxDnO+Efvgc4Aau65UP6HQSHqwAAHShBAMjbgARAAsi+5JeOxc7we+B6ws0MB0FAT67mA+64fQYBnnApHEYB64buuACE6kMMITaUAA9AAVAZcAAIKInAhYImwd4IWgcCEggkg7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1TimmTKRUuxbzalKWoZRNexgGkqOaQOP5XMMmPJeHRLpLE2LsT6WYPic5XlFOaMxd4MgJlwHYvMwpSy7zQHVpctAqyoU0FEuJJ8IQGqNJgKC8FKkYJktoE2XSbtDTwH8MkpKNK4B0uaduVZlBuV8EYh0DiSwVnCFFeKpAkqehyHVlJI8akKD6FWRyrQ7geVbllRKtC7EpUFXKPkRI7EMKrN+GKrJ24VX+PIBqmVyS5XbkNcanFpqEjpgtXOIVDqnWUCAA
π» Code
π Actual behavior
TypeScript compiler throws "Expression produces a union type that is too complex to represent" on
Filter
type instantiation with large interfaceπ Expected behavior
TypeScript compiler shouldn't throw "Expression produces a union type that is too complex to represent" on
Filter
type instantiation with large interfaceAdditional information about the issue
On 5.3.3, such issue doesn't occur (even when we are adding more parameters to
Update
interface, e.g. additional 20-30 parameters)But, on 5.4.2 it seems like limit for it is lowered down. When
chat_boost
andremoved_chat_boost
are removed, bothFilter
instantiations no longer throwing errorsThe text was updated successfully, but these errors were encountered: