Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(jest): narrow getJestPreset typings
this commit is a follow up to #5031 (5df16e6). it narrows the return type of the `JestFacade#getJestPreset` function from `any` to an alias to Jest's `Config.InitialOptions`. prior to #5031, the return type of `getJestPreset` would be inferred by the TypeScript compiler, and a dynamic import to an internal Jest type declaration file would be generated for the typing of the function: ```ts // a snippet of what was generated in `jest-stencil-connector.d.ts export declare const getJestPreset: () => Partial<{ coverageReporters: import("@jest/types/build/Config").CoverageReporters; // other fields omitted }>; ``` however, stencil cannot/should not make assumptions about the location of this file. by placing an alias, the dyanmic import is removed from the output `.d.ts` file (having the same effect as #5031). pr #5031 eliminated this by using `any` as an explicit return type, which would generate: ```ts export declare const getJestPreset: () => any; ``` with this commit, we now generate: ```ts export declare const getJestPreset: () => JestPresetConfig; ``` which no longer inlines dynamic imports for typings. STENCIL-1003 Dynamic Import Type Resolution Fails for Jest 28, 29
- Loading branch information