Skip to content

Nested objects based on indexer not checked for freshness #12566

@basarat

Description

@basarat

TypeScript Version: Nightly today

Code

type CSSPropertyMap = {
    color?: string
}
type NestedCSSProperties = {
    nested?: {
        [selector:string]: CSSProperties
    }
}

type CSSProperties = CSSPropertyMap & NestedCSSProperties;

let style: CSSProperties;

// ok
style = {
    color: 'red'
}

// ok
style = {
    nested: {
        '&:hover': {
            color: 'red'
        }
    }
}

// does error
style = {
    colour: 'red'
}

// should error but doesn't
style = {
    nested: {
        '&:hover': {
            colour: 'red'
        }
    }
}

Expected behavior:
Error

Actual behavior:
Does not error

Thanks 🌹

Metadata

Metadata

Assignees

No one assigned

    Labels

    Design LimitationConstraints of the existing architecture prevent this from being fixed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions