- 
                Notifications
    
You must be signed in to change notification settings  - Fork 13.1k
 
Closed as not planned
Closed as not planned
Copy link
Labels
Not a DefectThis behavior is one of several equally-correct optionsThis behavior is one of several equally-correct options
Description
π Search Terms
generic spread
π Version & Regression Information
- This changed on version 5.3.0-dev.20231027
 
β― Playground Link
π» Code
type MockFactoryWithHelper<M = unknown> = (
  importOriginal:<T extends M = M>() => Promise<T>
) => Partial<Record<keyof M, any>>
type PromiseMockFactoryWithHelper<M = unknown> = (
  importOriginal: <T extends M = M>() => Promise<T>
) => Promise<Partial<Record<keyof M, any>>>
const util: {
  mock<T>(module: Promise<T>, factory?: MockFactoryWithHelper<T>): void
  mock<T>(module: Promise<T>, factory?: PromiseMockFactoryWithHelper<T>): void
} = {
  mock: (() => {}) as any
};
(async function() {
  util.mock(import('path'), async (importOriginal) => ({
    ...(await importOriginal())
  }));
})();π Actual behavior
Typescirpt throw error like Spread types may only be created from object types.(2698); on line spread syntax
π Expected behavior
Typescirpt should not throw error on inline spread syntax.
Additional information about the issue
No response
Metadata
Metadata
Assignees
Labels
Not a DefectThis behavior is one of several equally-correct optionsThis behavior is one of several equally-correct options