-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptFixedA PR has been merged for this issueA PR has been merged for this issue
Milestone
Description
TypeScript Version: 2.4.0
Code
import {CSSProperties} from 'glamorous'
export const a = (): CSSProperties => ({})
export const b = ({withA = false}): CSSProperties => ({
...withA ? a() : undefined,
})Expected behavior:
No errors
Actual behavior:
TypeScript displays this error:
error TS2322: Type '{} | { [propertyName: string]: string | number | CSSProperties | undefined; alignContent?: "cente...' is
not assignable to type 'CSSProperties'.
Type '{}' is not assignable to type 'CSSProperties'.
Index signature is missing in type '{}'
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.
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptFixedA PR has been merged for this issueA PR has been merged for this issue