Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

Errors when using TS 1.8 string literal types #966

Closed
joeskeen opened this issue Feb 10, 2016 · 8 comments
Closed

Errors when using TS 1.8 string literal types #966

joeskeen opened this issue Feb 10, 2016 · 8 comments

Comments

@joeskeen
Copy link

I'm using TS 1.8 beta, and when I try to use the new String Literal Types (microsoft/TypeScript#5185), I get errors:

type CardinalDirection = 'North' | 'East' | 'South' | 'West';
Failed to lint: 
... forbidden bitwise operation, 
... forbidden bitwise operation, 
... forbidden bitwise operation, 
... expected an assignment or function call.

I'm using the latest TSLint (2.5.1).

@jkillian
Copy link
Contributor

@joeskeen Actually, you'll want tslint@3.3.0 or tslint@3.4.0-dev.1. You shouldn't see the error anymore with either of those versions of TSLint 😃.

@joeskeen
Copy link
Author

That works great!
I knew I was missing something... thanks for the help! :)

@jack-guy
Copy link

I'm on tslint@3.5.0 and I'm getting

Type expected. The left-hand side of an arithmetic operation must be of type 'any', 'number', or an enum type.

type Valid = 'pending' | 'approved' | 'denied';

Do you know why?

@jkillian
Copy link
Contributor

@Harangue What version of TypeScript are you using? You'll want something > 1.8

@jack-guy
Copy link

Global and local are at 1.8.2.

@jkillian
Copy link
Contributor

@Harangue That error message is one generated by TypeScript (not TSLint). Perhaps the version of TypeScript your IDE is using is out of date?

@jack-guy
Copy link

@jkillian Sorry 'bout that - turns out it was VSCode's fault. Apparently it has its own separate TypeScript install separate from global and local and sdk installations and I mistakenly took it for a tslint issue. Bleh.

@nikkwong
Copy link

nikkwong commented Apr 19, 2016

Unfortunately I'm still getting this issue on tslint 3.7.4, though I'm running it through gulp-tslint@3.6.0 which should defer to the local tslint. How can I go about troubleshooting this? I also have the latest typescript locally and globally.

Thanks.

line 1  col 16  expected an assignment or function call

    ✖ 1 error

[22:32:19] 'tslint' errored after 1.31 s
[22:32:19] Error in plugin 'gulp-tslint'

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants