Skip to content

Typescript types generation enhancement #970

@madiyetov

Description

@madiyetov

Thanks for the typescript types generation feature. It's awesome.

Is your feature request related to a problem? Please describe.

We have slices separated in two directories. One in a project level directory, another one in a package.
So our config looks something like this:

// slicemachine.config.json
{
  "adapter": "@slicemachine/adapter-nuxt2",
  "libraries": ["./node_modules/common-slices/src/slices", "./slices"],
}

But all typescript types are generated and merged into one file in a project level. Which makes impossible to use generated types in common slices.

Describe the solution you'd like

I would suggest the simple thing. To generate 2 separate files. We can rely on the slicemachine.config.json's libraries to determine the directory to put these files. So in the end we will have 2 files which makes sense to me:
./node_modules/common-slices/src/slices/prismicio-types.d.ts
./slices/prismicio-types.d.ts

As a bonus, we can consider to generate custom types' types into customtypes folder.

Describe alternatives you've considered

It's not possible to use the file from a project level in a package.

Additional context

Our project is a monorepo structured where our common slices are located in a package and we can have multiple applications using them.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions