Including typings from the piral instance fails

50 Views Asked by At

I have already found out how to properly type plugins in piral (by using declaration merging).

This only seems to work for pilet api extensions coming from dedicated packages and also only if there is an api.d.ts in its root folder.

How can I type pilet api extensions that are defined directly in the piral instance?

What I tried so far:

  1. Placing an api.d.ts in the src folder
  2. Placing the relevant typings directly in the src/index.tsx file
  3. Changing the typings field in the package.json to either one (and others like src/types.ts)
1

There are 1 best solutions below

0
On BEST ANSWER

Have you tried placing the api.d.ts adjacent to the package.json? That should work!

Besides that the api.d.ts can be as simple as follows:

export { MyPiletApi} from './src/types';

Hope that helps!