typescript 打字稿编译错误:错误 TS1109:预期表达

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/35821614/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 06:59:00  来源:igfitidea点击:

Typescript compile error: error TS1109: Expression expected

typescript

提问by Dongsheng Cai

I have this very simple typescript file:

我有这个非常简单的打字稿文件:

export default const VERSION: number = 2016030600;

Then I run:

然后我运行:

tsc version.ts

typescript compiler (Version 1.8.7, OS X) complains:

打字稿编译器(版本 1.8.7,OS X)抱怨:

version.ts(1,16): error TS1109: Expression expected.

How can I fix this error? Thank you.

我该如何解决这个错误?谢谢你。

回答by Nathan Friend

Do your VERSIONassignment as a separate statement:

将您的VERSION作业作为单独的语句进行:

const VERSION: number = 2016030600;
export default VERSION;