Closed
Description
Hey you all - I'm testing out the 2.0.0-rc.1 and vs 1.2.2 I have a component that fails to setState correctly.
private _onNextPage = () => {
console.log(
'TIPI::_onNextPage - was on page ' + this.state.pageIndex + ' (max is ' + this.MAX_PAGE + ')'
);
let nextIndex = this.state.pageIndex + 1;
this.setState({ pageIndex: nextIndex >= this.MAX_PAGE ? this.MAX_PAGE : nextIndex });
console.log('TIPI::_onNextPage - will be on page ' + this.state.pageIndex);
};
It's a simple pager, and I get 'will be on page 0' (the initial state) every click with 2.0.0-rc.1 but it increments nicely with 1.2.2.
That's a vague report in and of itself but it is a clear regression with this code between those two versions.
I'm trying to get a repro together but in the meantime I also see this on an npm test
execution
mike@isabela:~/work/react-random/resub (master) % npm test
> resub@2.0.0-rc.1 test /home/mike/work/react-random/resub
> run-s clean:* karma:single-run
> resub@2.0.0-rc.1 clean:dist /home/mike/work/react-random/resub
> rimraf dist*
> resub@2.0.0-rc.1 karma:single-run /home/mike/work/react-random/resub
> karma start --singleRun
Starting type checking service...
Using 1 worker with 2048MB memory limit
Type checking in progress...
ℹ 「wdm」: Compiled successfully.
ℹ 「wdm」: Compiling...
ERROR in /home/mike/work/react-random/resub/test/AutoSubscribe.spec.tsx(128,7):
TS2417: Class static side 'typeof OverriddenComponent' incorrectly extends base class static side 'typeof SimpleComponent'.
Types of property 'getDerivedStateFromProps' are incompatible.
Type 'GetDerivedStateFromProps<SimpleProps, SimpleState>' is not assignable to type 'GetDerivedStateFromProps<unknown, unknown>'.
Types of parameters 'nextProps' and 'nextProps' are incompatible.
Property 'ids' is missing in type 'Readonly<unknown>' but required in type 'Readonly<SimpleProps>'.
Version: typescript 3.5.3
Time: 2315ms
ℹ 「wdm」: Compiled successfully.
Metadata
Metadata
Assignees
Labels
No labels