-
Notifications
You must be signed in to change notification settings - Fork 12.8k
[NewErrors] 4.6.0-dev.20211126 vs 4.5.2 #46939
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I'm not 100% sure why this wasn't an error before. The loop definitely exists: export class Wizard extends React.Component<WizardProps, State> {
public state: State = {
step: this.getValidStep(this.props.step), // <----
};
get steps() {
const { className, title, step, header, onChange, children, ...commonProps } = this.props;
const steps = React.Children.toArray(children) as WizardStepElem[];
return steps.filter(step => !step.props.skip).map((stepElem, i) => {
const stepProps = stepElem.props;
return React.cloneElement(stepElem, {
step: i + 1,
wizard: this,
next: this.nextStep,
prev: this.prevStep,
first: this.firstStep,
last: this.lastStep,
isFirst: this.isFirstStep, // <------
isLast: this.isLastStep,
...commonProps,
...stepProps,
} as WizardStepProps<any>);
});
}
get step() {
return this.state.step; <----
}
isFirstStep = () => this.step === 1; <-----
protected getValidStep(step: number) {
return Math.min(Math.max(1, step), this.steps.length) || 1; <----
} need to bisect this based on an isolated repro to see if the root cause is problematic |
OK, here's the tiny version declare const props: WizardStepProps;
export class Wizard {
get steps() {
return {
wizard: this,
...props,
} as WizardStepProps;
}
}
export interface WizardStepProps {
wizard?: Wizard;
} |
Caused by #45729. When we do subtype reduction of the two contributors of return {
wizard: this as Wizard,
...props,
} as WizardStepProps; but this also fails in main today. I have a fix in |
This code has a type circularity that previously went undetected. Adding an `as Wizard` assertion here removes the circularity. See microsoft/TypeScript#46939 / microsoft/TypeScript#46981
The following errors were reported by 4.6.0-dev.20211126, but not by 4.5.2
lensapp/lens
4 of 5 projects failed to build with the old tsc
tsconfig.json
error TS7023: 'steps' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions.
error TS7006: Parameter 'stepElem' implicitly has an 'any' type.
The text was updated successfully, but these errors were encountered: