π Search Terms
TS1265
π Version & Regression Information
- This changed between versions 5.3.3 and 5.4.2
β― Playground Link
https://www.typescriptlang.org/play?ts=5.4.2#code/MYewdgzgLgBAZgSwE7QPICMBWBTYsC8MA3nCCAFwwDkpIVAvjAIYQyiRQDcAUO9DBFzgAJhhx4YhIuiZJKVGUgbNWfLt17h+iFFADCWqEzAEYAbSpMANlaoAaGADpnACjG4ojgNbYAnhBcdNCwPAEpQgF0VNkMeNQEhMGEDDmNTC2tbB2dHNxC8bz8AwXZRfKhwqJYYjh5uKF8AB2wYADFkaAAVJpbCBuaQOHgO-UM0nn6WgGVE4W7myRhJwYTSlOhxjUmYAwBbdAQwbDmexaRsJmFwK19zbhgnZ3bdeew7e8fHGdLX94ieIA
π» Code
const firstObject = {foo: 'foo'} as const;
const secondObject = {bar: 'bar'} as const;
const firstConstant = ['all', ...(Object.keys(firstObject))] as const;
const secondConstant = ['all', ...(Object.keys(secondObject))] as const;
type FirstType = typeof firstConstant;
type SecondType = typeof secondConstant;
type CombinedType = readonly [
...FirstType,
...SecondType,
];
Workbench Repro
π Actual behavior
A rest element cannot follow another rest element.(1265)
π Expected behavior
No error
Additional information about the issue
No response