admin管理员组文章数量:1387285
I'm trying to compile the code below and I get the error: error TS1110: Type expected
import { LayoutBase } from '../layout-base';
import { Style } from '../../styling/style';
import { CssProperty } from '../../core/properties';
import { View } from '../../core/view';
import { CoreTypes } from '../../enums';
export type FlexDirection = 'row' | 'row-reverse' | 'column' | 'column-reverse';
export type FlexWrap = 'nowrap' | 'wrap' | 'wrap-reverse';
export type FlexFlow = `${FlexDirection} ${FlexWrap}`;
What is wrong with the last line of code.
Error image
I expect the code to run without error
I'm trying to compile the code below and I get the error: error TS1110: Type expected
import { LayoutBase } from '../layout-base';
import { Style } from '../../styling/style';
import { CssProperty } from '../../core/properties';
import { View } from '../../core/view';
import { CoreTypes } from '../../enums';
export type FlexDirection = 'row' | 'row-reverse' | 'column' | 'column-reverse';
export type FlexWrap = 'nowrap' | 'wrap' | 'wrap-reverse';
export type FlexFlow = `${FlexDirection} ${FlexWrap}`;
What is wrong with the last line of code.
Error image
I expect the code to run without error
Share Improve this question edited Mar 17 at 14:58 Krzysztof Guć asked Mar 17 at 14:53 Krzysztof GućKrzysztof Guć 234 bronze badges2 Answers
Reset to default 2You are using older version of TypeScript (below 4.0.5), type interpolation was introduced from version 4.1.5 onwards.
https://www.typescriptlang./play/?ts=4.1.5#code/KYDwDg9gTgLgBDAnmYcBiAbUARAllYAYxlwgDs4BeOAciggHca4AfW+hgWgIDdgoAzsGZsahCBgCuAWzIja4qbO7A+g4QG4AUKEiwEyVJlAB1KAEMwVWmUYWw8mg3uPnllWqE1tu6PCQo6FggmIzWAAYAJADexiB4BMSkZAC+cDFxZpYp4dpAA
You can change version on the left to 4.0.5 to see the same error.
For the best results, you can add typescript as a dev dependency in your project or install new version of typescript globally on your machine.
try to update your typescript may solve your problem because it seems like your using the older version of Typscript
本文标签: Typescriptwhat39s wrongerror TS1110 Type expectedStack Overflow
版权声明:本文标题:Typescript - what's wrong - error TS1110: Type expected - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744553042a2612302.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论