How to use TypeScript to map a large object to a smaller interface?
问题 I have an object returned from a server that contains e.g. { lorem: 1, ipsa: [2,3], dolor: { sit: 'amet', consectetur: 'adipiscing'}, elit: [{you: 'get'}, {the: 'picture'}] } and a TypeScript interface of export interface smallerInterface { ipsa: number[]; elit: any[]; } I'm saving the returned object into IndexedDb, and don't want to save any fields that are not present on the interface. I have tried casting fullObject as smallerInterface and <smallerInterface>fullObject , but when saving