CSSProperties TextAlignProperty type error

Viewed 3630

I'm using React 16.8 with Typescript "@zeit/next-typescript": "1.1.0"

I have inline-style interface. And There is object using IInputInlineStyle interface.

interface IInputInlineStyle {
    padding: string;
    textAlign?: string;
    paddingLeft?: string | number;
    color?: string;
}

 const inputInlineStyle: IInputInlineStyle = {
            padding,
            textAlign
        };

But I got this error message.

Error:(155, 21) TS2322: Type 'IInputInlineStyle' is not assignable to type 'CSSProperties'.

Types of property 'textAlign' are incompatible.

Type 'string' is not assignable to type 'TextAlignProperty'.

How can I fix this problem?

2 Answers

Have you tried changing the textAlign property to from type string to type TextAlignProperty?

Related