danielearwicker / doop

Succint immutable record classes for TypeScript
MIT License
12 stars 0 forks source link

cannot invoke an expression whose type lacks a type signature #2

Closed drew-moore closed 8 years ago

drew-moore commented 8 years ago

First off, hell yes to this project. I've been working on reactive approaches to state management in Angular 2 applications lately, most recently using (the awesome) @ngrx/store. Immutable data structures are hugely beneficial, but I've yet to find a way of implementing them in TypeScript that a) preserves type-safety and b) doesn't seriously harm code readability. I stumbled across this repo last night and so far I'm thinking it might fit the bill.

One issue though, is that my IDE (Intellij 15, but presumably others as well) doesn't understand the magic and therefore gives me "cannot invoke an expression whose type lacks a type signature" warnings on every call to a @doop getter function.

The code compiles and runs as expected, of course, but any thoughts / advice on making doop play nicely with IDEs?

danielearwicker commented 8 years ago

Excellent! Glad you like it.

I've just downloaded the preview of the next WebStorm version (presumably the same stuff as IntelliJ) and it appears to be fine (playing around in DoopSpec.ts it's all behaving itself). So maybe a bug they've only just fixed in their own parsing code?

In the meantime you could do what I do - use the free Atom editor and install the fantastic plugin @TypeStrong/atom-typescript. It works completely automatically and doesn't require any project files of its own (just uses tsconfig.json). The maintainer (who is extremely helpful) keeps it constantly up-to-date with the latest TS language service.

Even so I think doop is only using quite old features of the language (in terms of the type system). Decorators date back to 1.5, and I think property getters on classes were in very old versions. The MS compiler is already a callable service but maybe JetBrains don't use that.