Export types from /server entrypoint#216
Conversation
| // This file exists so that typescript understands the following: | ||
| // import 'single-spa-layout/server' | ||
| export * from "../single-spa-layout-server"; | ||
| export * from "../single-spa-layout-server-interface"; |
There was a problem hiding this comment.
Why create a separate single-spa-layout-server-interface file rather than add the exports to src/server/index.ts?
There was a problem hiding this comment.
The types for the package's /server entry point are located in ./dist/types/single-spa-layout-server.d.ts, as specified in the package.json file.
As far as I can tell, the src/server/index.ts file is not used by TypeScript, which means we cannot rely solely on it for type definitions. However, it's possible that older versions of TypeScript might still use src/server/index.ts. I don't know about that, but after all the file was certainly added for a reason.
In the end, I followed the same approach as with the package's default entry point by creating the single-spa-layout-server-interface file. Additionally, I added the rexport in src/server/index.ts to be on the safe side for older TypeScript versions.
Hello,
as suggested in #214, here's the MR to add type definitions for the package's
/serverentrypoint.It follows the existing approach of the default entrypoint by adding
single-spa-layout-server-interface.tsthat reexports JS values and adds some type exports.