【问题标题】:Typescript compile error: error TS1109: Expression expected打字稿编译错误:错误 TS1109:预期表达式
【发布时间】:2016-06-19 16:43:59
【问题描述】:

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

export default const VERSION: number = 2016030600;

然后我运行:

tsc version.ts

typescript 编译器(版本 1.8.7,OS X)抱怨:

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

如何解决此错误?谢谢。

【问题讨论】:

    标签: typescript


    【解决方案1】:

    VERSION 赋值作为单独的语句:

    const VERSION: number = 2016030600;
    export default VERSION;
    

    【讨论】:

    • 快速/相关说明:如果您在声明文件中发现同样的错误,此答案提示我正确的语法是 declare const VERSION: number; export default VERSION
    • 了解为什么我们也需要使用单独的语句会很有趣。
    猜你喜欢
    • 2016-06-19
    • 2023-04-08
    • 1970-01-01
    • 2021-01-02
    • 1970-01-01
    • 1970-01-01
    • 2023-03-25
    • 2017-06-26
    • 1970-01-01
    相关资源
    最近更新 更多