Skip to content
This repository has been archived by the owner on Jun 26, 2023. It is now read-only.

Typescript 2.9 support #1

Closed
esamattis opened this issue May 21, 2018 · 4 comments
Closed

Typescript 2.9 support #1

esamattis opened this issue May 21, 2018 · 4 comments

Comments

@esamattis
Copy link

Hi! First of all thanks for great library!

Just tried this with the new Typescript 2.9rc but unfortunately it seems to be quite incompatible.

node_modules/redutser/declaration/subdomain.d.ts:32:218 - error TS2536: Type 'DictKey' cannot be used to index type 'RedDict[k] extends Redutser<any, infer D> ? D : never'.

node_modules/redutser/declaration/subdomain.d.ts:32:390 - error TS2536: Type 'ACKey' cannot be used to index type '{ [k in keyof RedDict]: RedDict[k] extends Redutser<any, any>? Redutser<State, { [DictKey in key...'.

node_modules/redutser/declaration/subdomain.d.ts:32:548 - error TS2536: Type 'DictKey' cannot be used to index type 'RedDict[k] extends Redutser<any, infer D> ? D : never'.

node_modules/redutser/declaration/subdomain.d.ts:36:269 - error TS2536: Type 'DictKey' cannot be used to index type 'RedDict[k] extends Redutser<any, infer D> ? D : never'.

node_modules/redutser/declaration/subdomain.d.ts:38:204 - error TS2536: Type 'DictKey' cannot be used to index type 'RedDict[k] extends Redutser<any, infer D> ? D : never'.

node_modules/redutser/declaration/subdomain.d.ts:41:238 - error TS2536: Type 'DictKey' cannot be used to index type 'RedDict[k] extends Redutser<any, infer D> ? D : never'.

node_modules/redutser/declaration/subdomain.d.ts:43:204 - error TS2536: Type 'DictKey' cannot be used to index type 'RedDict[k] extends Redutser<any, infer D> ? D : never'.

node_modules/redutser/declaration/subdomain.d.ts:46:205 - error TS2536: Type 'DictKey' cannot be used to index type 'RedDict[k] extends Redutser<any, infer D> ? D : never'.

Probably due to the new symbol/number support in keyof.

@wkrueger
Copy link
Owner

wkrueger commented May 29, 2018

From what I have investigated, 2.9s versions seem to be toying with changes on the .d.ts generation. Those errors don't appear while developing on the library, even with TS 2.9. They only show up when consuming the generated .d.ts.

I found out that compiling with the latest TS nightly ("insiders") seem to get rid of those errors. Unfortunately, that also breaks consumption from TS 2.8 (parse errors). I guess that the best I can do is to publish a 2.9 branch while TS2.9 still is not stable.

@esamattis
Copy link
Author

Tried building redutser with the new stable TS 2.9.1 but got this:

src/redutser.ts:30:28 - error TS2339: Property 'type' does not exist on type 'FnReturn<ActionCreatorsFromReducerDict<Dict>[keyof Dict]>'.

30     if (reducerDict[action.type]) {
                              ~~~~


src/redutser.ts:31:33 - error TS2339: Property 'type' does not exist on type 'FnReturn<ActionCreatorsFromReducerDict<Dict>[keyof Dict]>'.

31       return reducerDict[action.type](state, action.payload)
                                   ~~~~


src/redutser.ts:31:53 - error TS2339: Property 'payload' does not exist on type 'FnReturn<ActionCreatorsFromReducerDict<Dict>[keyof Dict]>'.

31       return reducerDict[action.type](state, action.payload)
                                                       ~~~~~~~

esamattis added a commit to esamattis/redutser that referenced this issue Jun 1, 2018
Fixes TS 2.9 build

Fixes wkrueger#1
@wkrueger
Copy link
Owner

wkrueger commented Jun 1, 2018

Yeah, that 2.9 branch also had that "fix"(I just added an "any" there). I haven't published that branch as a npm tag, it's currently just a git tag (yarn add https://github.com/wkrueger/redutser.git#ts2.9).

Now that 2.9 is official I might just publish that branch as mainstream soon (and ask TS 2.8 users to install the old one), but before that I'm willing to have another try in achieving something that works on both 2.8 and 2.9 and have a more patient read on that keyof TS change.

https://github.com/Microsoft/TypeScript/wiki/What%27s-new-in-TypeScript

@wkrueger
Copy link
Owner

  • Pushed new version 0.13.x targeted at at ts 2.9.
  • Pushed a branch and npm tag @ts.28 built with ts2.8, targeted at ts 2.8.

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

Successfully merging a pull request may close this issue.

2 participants