-
Notifications
You must be signed in to change notification settings - Fork 12.8k
2.4 errors for missing index signature with object literal spread #16694
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@Pajn could you share your tsconfig as well just from the code I can't really repro the issue |
Here it is:
If it works with a standard config I guess the troublemakers might be |
Still no luck in repo this .... From the error message, is there more properties in return type of |
I'm sorry. There were two big issues with the report. For completeness, here is the actual code where I experienced the bug and its error message:
import {CSSProperties} from 'glamorous'
export const flex = (
flex: number | boolean | {grow?: number; shrink?: number},
): CSSProperties => ({
flexGrow: flex === true
? 1
: flex === false
? undefined
: flex === undefined
? undefined
: typeof flex === 'number' ? flex : flex.grow,
flexShrink: flex === true
? undefined
: flex === false
? undefined
: flex === undefined
? undefined
: typeof flex === 'number' ? flex : flex.grow,
})
export const column = ({
horizontal,
vertical,
self,
reverse,
flex: flex_,
}: {
horizontal?: 'center' | 'flex-start' | 'flex-end' | 'stretch' | 'baseline'
vertical?:
| 'center'
| 'flex-start'
| 'flex-end'
| 'space-between'
| 'space-around'
self?: 'center' | 'flex-start' | 'flex-end' | 'stretch'
reverse?: boolean
flex?: number | boolean | {grow?: number; shrink?: number}
}): CSSProperties => ({
display: 'flex',
flexDirection: reverse ? 'column' : 'column-reverse',
alignItems: horizontal,
justifyContent: vertical,
self,
...flex_ === undefined ? undefined : flex(flex_),
}) |
We found the reason for this issue that we will fix in the nightly. But in the meantime, the workaround is |
The problem is that object types are supposed to have a symbol set, which The predicate in |
Awesome! |
Fixed in #18965 |
TypeScript Version: 2.4.0
Code
Expected behavior:
No errors
Actual behavior:
TypeScript displays this error:
The code works fine in 2.3.4 which is what I would expect. I return an object literal, there is nothing that should prevent it to be assigned to a more open type.
Without the tenery at the spread position the code gives no errors.
The text was updated successfully, but these errors were encountered: