TypeScript/tests/cases/compiler/thisIndexOnExistingReadonlyFieldIsNotNever.ts
Wesley Wigham 0dbad04c3f
Distribute indexed accesses when simplifying them (#26281)
* unknownify accesses

* Move to simplify to break less with fewer changes

* Accept baselines for now

* Always propegate any as an index type

* Fix flow control in the presence of simplifiable types

* Add spy repro from #25181

* Retain errorType when it is used as a marker for the lack of a constraint

* Small refinement

* Add new test

* Move most potentially recursive types from isIdenticalTo into structuredTypeRelatedTo to match the non-identity relations

* Fix nits

* Doesnt need to be undefineable at all
2018-08-27 13:32:01 -07:00

23 lines
697 B
TypeScript

// @strict: true
declare class Component<P, S = {}> {
readonly props: Readonly<{ children?: unknown }> & Readonly<P>;
state: Readonly<S>;
}
interface CoachMarkAnchorProps<C> {
anchorRef?: (anchor: C) => void;
}
type AnchorType<P> = Component<P>;
class CoachMarkAnchorDecorator {
decorateComponent<P>(anchor: P) {
return class CoachMarkAnchor extends Component<CoachMarkAnchorProps<AnchorType<P>> & P, {}> {
private _onAnchorRef = (anchor: AnchorType<P>) => {
const anchorRef = this.props.anchorRef;
if (anchorRef) {
anchorRef(anchor);
}
}
};
}
}