diff --git a/types/jasmine/index.d.ts b/types/jasmine/index.d.ts index 1e0105c807..3bab6a2ecd 100644 --- a/types/jasmine/index.d.ts +++ b/types/jasmine/index.d.ts @@ -207,7 +207,7 @@ declare namespace jasmine { type SpyObjPropertyNames = T extends undefined ? (ReadonlyArray | { [propertyName: string]: any }) : - (ReadonlyArray); + (ReadonlyArray | { [P in keyof T]?: T[P] }); /** * Configuration that can be used when configuring Jasmine via {@link jasmine.Env.configure} diff --git a/types/jasmine/jasmine-tests.ts b/types/jasmine/jasmine-tests.ts index 8dd9f77141..1b77e13a69 100644 --- a/types/jasmine/jasmine-tests.ts +++ b/types/jasmine/jasmine-tests.ts @@ -1563,6 +1563,36 @@ describe("createSpyObj", function() { expect(spyObj.m()).toEqual(3); expect(spyObj.p).toEqual(4); }); + + it("allows methods and properties lists to omit entries from typed object", function() { + interface Template { + method1(): number; + method2(): void; + readonly property1: string; + property2: number; + } + const spyObj = jasmine.createSpyObj