( map: WeakMap<Instance, Internal>, pl: Instance, ...fields: Field[] )
| 42 | } |
| 43 | |
| 44 | export function getMultiInternalSlots< |
| 45 | Instance extends object, |
| 46 | Internal extends object, |
| 47 | Field extends keyof Internal, |
| 48 | >( |
| 49 | map: WeakMap<Instance, Internal>, |
| 50 | pl: Instance, |
| 51 | ...fields: Field[] |
| 52 | ): Pick<Internal, Field> { |
| 53 | const slots = map.get(pl) |
| 54 | if (!slots) { |
| 55 | throw new TypeError(`${pl} InternalSlot has not been initialized`) |
| 56 | } |
| 57 | return fields.reduce( |
| 58 | (all, f) => { |
| 59 | all[f] = slots[f] |
| 60 | return all |
| 61 | }, |
| 62 | Object.create(null) as Pick<Internal, Field> |
| 63 | ) |
| 64 | } |
| 65 | |
| 66 | export interface LiteralPart { |
| 67 | type: 'literal' |
no test coverage detected