Given an interface (from an existing .d.ts file that can\'t be changed):
interface Foo { [key: string]: any; bar(): void; }
Is there a
There is not a really generic way for it, but if you know which properties you need, then you can use Pick:
interface Foo { [key: string]: any; bar(): void; } type FooWithOnlyBar = Pick; const abc: FooWithOnlyBar = { bar: () => { } } abc.notexisting = 5; // error