19

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:

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

How can I fix this error? Thank you.

1 Answer 1

20

Do your VERSION assignment as a separate statement:

const VERSION: number = 2016030600;
export default VERSION;
Sign up to request clarification or add additional context in comments.

2 Comments

Quick/related note: if you find this same error in a declaration file, this answer hinted to me the correct syntax there which is declare const VERSION: number; export default VERSION.
It would be interesting to know why we need to use separate statements as well.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.