Proposed usage is not compatible with typescript 3.1.3.
Closed this issue · 6 comments
After upgrade project to Angular 7 (ts 3.1.3) usage like this:
export const SampleAction = action('SOME_ACTION', payload<any>());
is not compatible.
Now we need to add T definition like:
export const SampleAction = action<string>('SOME_ACTION', payload<any>());
I supposed that "T extends string" has different meaning in new ts.
What's the error? Note that the package is tested with 3.1.3 and these tests pass: https://github.com/cartant/ts-action/blob/master/source/action-spec.ts#L186-L256
Actually, 3.1.4 is out and they pass with that, too.
After some investigating it looks like ts works, but this is a problem with tslint. In first usage I have a message that "Type argument cannot be inferred from usage".
Without a bug report that details exactly what your configuration is, there's not much I can suggest. Except that TSLint is also used in this project. If you are interested, you could look at the version and configuration that's used here. I usually use the latest (non-pre-release) releases of TypeScript and TSLint in my projects.
I am trying to reproduce this issue in your project but I can't. It looks like in our project it could be related with updated version and configuration of IDE. Until I reproduce this bug we can close it and will return to it later. It's related also with ts-action-operators. For now - sorry for the problem. If someone will have similar issues - please let me know here.
No worries. IDEs can certainly confuse things. I've reported TypeScript bugs based on IDE behaviour only to discover that they'd already been fixed and the IDE I was using wasn't using the latest version of TypeScript. 😬