[bug]: init uses RC versions and disables TypeScript for design-system v2

Open
#91 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 6 days

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
typescript
Domain
cli, tooling

Research direction

Start with src/cli/commands/plugin/init/action.ts and src/cli/commands/plugin/init/files/admin.ts, especially the marked TODO sections. Run npx @strapi/sdk-plugin@latest init and inspect the generated package versions and admin/custom.d.ts. Done means the init path no longer causes unintended RC use or suppresses design-system type errors, with the intended behavior verified.

Written by the indexing model from the issue text.

Description

issue: bug severity: medium source: sdk-plugin status: pending reproduction version: 5
What version of design-system are you using?

v2

What's Wrong?

see this issue in the strapi project

When using the plugin init command, the SDK pulls in the release candidate (RC) version of @strapi/design-system, and at the same time disables TypeScript type checking by generating a custom.d.ts file that declares the entire module. This makes VSCode silently accept incorrect imports and breaks type safety.

Using
npx @strapi/sdk-plugin@latest init

It automatically sets up the plugin to use Design System V2 (RC). Specifically, in @strapi/sdk-plugin src/cli/commands/plugin/init/action.ts, there's this line:

// TODO: remove these when release versions are available
const USE_RC_VERSIONS: string[] = ['@strapi/design-system', '@strapi/icons'] as const;

This causes it to pull the RC (v2) versions of those packages.

Additionally, in the same package at src/cli/commands/plugin/init/files/admin.ts, it generates a custom.d.ts file using the following:

{
    /**
     * TODO: remove this when we release design-system V2
     */
    name: 'admin/custom.d.ts',
    contents: outdent`
        declare module '@strapi/design-system/*';
        declare module '@strapi/design-system';
    `,
  },

This effectively disables TypeScript support for the design system, which explains why VSCode didn’t catch my incorrect imports :(

To Reproduce

Run:

npx @strapi/sdk-plugin@latest init

Try using a design-system component with a wrong import, VSCode won’t show an error because types are completely bypassed.

Expected Behaviour
  • Either avoid using RC versions by default (unless explicitly opted in).
  • Or at least don’t disable type checking by generating a custom.d.ts that declares wildcard modules.
  • Ideally, wait until design-system v2 is stable before switching defaults in the SDK.
Dominant language
TypeScript
Stars
24
Forks
13
Avg merge
5d 3h
Merged PRs (30d)
5

Getting set up

  • No Dockerfile or Docker Compose file
  • Has a pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from strapi/sdk-plugin

All issues in strapi/sdk-plugin

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.