Skip to content

Splitting computed and named properties in an interface into two categories #8597

Closed
@Thomas-P

Description

@Thomas-P

Hi,

I have a question about computed properties. I have an interface that can have mutliple computed properties which can have a string as value and some specified properties that should have a number as their value. So my interface looks like this.

interface IComputedTest{
    [name: string]: string
    numberProperty: number;
}

On building the interfaces like this, I thought that they could work with a specification priority. So computed priority is very low and a numberProperty than overwrite the rule for the computed property. But since I realized that it would not work like this for now, my question is how can I solve the problem, that I have specific keys with other types and computed keys with there own type?

Is there a way around them?

Metadata

Metadata

Assignees

No one assigned

    Labels

    QuestionAn issue which isn't directly actionable in codeWorking as IntendedThe behavior described is the intended behavior; this is not a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions