Skip to content

Commit

Permalink
fix(core): supports TS 4.8.3 #3514
Browse files Browse the repository at this point in the history
  • Loading branch information
satanTime committed Sep 9, 2022
1 parent 3f6b81d commit 5b49b92
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion libs/ng-mocks/src/lib/common/func.is-jest-mock.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ describe('func.is-jest-mock', () => {
});

it('handles objects', () => {
const test: Record<any, any> = {};
const test: Record<keyof any, any> = {};
expect(funcIsJestMock(test)).toEqual(false);

test._isMockFunction = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export class MockBuilderPerformance extends MockBuilderPromise {
return config;
}

private equalsTo(prototype: Record<any, any>): boolean {
private equalsTo(prototype: Record<keyof any, any>): boolean {
for (const key of ['beforeCC', 'keepDef', 'replaceDef', 'excludeDef', 'mockDef']) {
if (!areEqualSets((this as any)[key], prototype[key])) {
return false;
Expand Down
4 changes: 2 additions & 2 deletions libs/ng-mocks/src/lib/mock-component/mock-component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const mixRenderReorderViews = (
}
};

const mixRenderApplyContext = (view: EmbeddedViewRef<any>, context: Record<any, any>): void => {
const mixRenderApplyContext = (view: EmbeddedViewRef<any>, context: Record<keyof any, any>): void => {
for (const contextKey of Object.keys(view.context)) {
view.context[contextKey] = undefined;
}
Expand All @@ -74,7 +74,7 @@ const mixRenderHandleViews = (
templates: any[],
views: Array<EmbeddedViewRef<any>>,
indices: undefined | number[],
context: Record<any, any>,
context: Record<keyof any, any>,
): number => {
let index = -1;

Expand Down
2 changes: 1 addition & 1 deletion libs/ng-mocks/src/lib/mock-render/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,6 @@ export interface MockedComponentFixture<C = any, F = DefaultRenderComponent<C>>
*
* @see https://ng-mocks.sudo.eu/api/MockRender
*/
export type DefaultRenderComponent<MComponent extends Record<keyof any, any>> = {
export type DefaultRenderComponent<MComponent> = {
[K in keyof MComponent]: MComponent[K];
};
2 changes: 1 addition & 1 deletion libs/ng-mocks/src/lib/resolve/collect-declarations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const pushDecorator = (decorators: string[], decorator: string): void => {
}
};

const getAllKeys = <T>(instance: T): Array<keyof T> => {
const getAllKeys = <T extends Record<keyof any, any>>(instance: T): Array<keyof T> => {
const props: string[] = [];
for (const key of Object.keys(instance)) {
props.push(key);
Expand Down

0 comments on commit 5b49b92

Please sign in to comment.