TypeScript/tests/cases/compiler/genericIndexedAccessMethodIntersectionCanBeAccessed.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

21 lines
482 B
TypeScript

// @strict: true
type ExtendedService<T> = {
[K in keyof T]: T[K] & {
__$daemonMode?: string;
__$action?: string;
};
};
type Service<T> = {
[K in keyof T]: T[K] & {id?: string};
};
export const createService = <T>(
ServiceCtr: ExtendedService<T> & Service<T>
) => {
Object.keys(ServiceCtr).forEach(key => {
const method = (ServiceCtr)[key as keyof T];
const {__$daemonMode, __$action, id} = method;
})
}