Skip to content

[Feature?]: @solidjs/start should provide .d.ts #1228

@Brendonovich

Description

@Brendonovich

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Current behavior 😯

@solidjs/start currently points to .ts and .tsx files for resolving type information.

"types": "./shared/index.tsx",
"exports": {
  ".": "./shared/index.tsx",
  "./config": "./config/index.js",
  "./server": "./server/index.tsx",
  "./server/spa": "./server/spa/index.tsx",
  "./client": "./client/index.tsx",
  "./client/islands": "./client/islands.tsx",
  "./middleware": "./server/middleware.ts",
  "./client/spa": "./client/spa/index.tsx"
},
"typesVersions": {
  "*": {
    ".": [
      "./shared/index.tsx"
    ],
    "./server": [
      "./server/index.tsx"
    ],
    "./client": [
      "./client/index.tsx"
    ]
  }
},

Using source .ts files makes skipLibCheck ineffective, leading to errors like this

node_modules/.pnpm/@solidjs+start@0.4.4_rollup@2.79.1_solid-js@1.8.8_vinxi@0.1.1_vite@4.5.1/node_modules/@solidjs/start/shared/dev-overlay/CodeView.tsx:59:18 - error TS2532: Object is possibly 'undefined'.

59     const lang = props.fileName
                    ~~~~~~~~~~~~~~
60       .split(/[#?]/)[0]
   ~~~~~~~~~~~~~~~~~~~~~~~

node_modules/.pnpm/@solidjs+start@0.4.4_rollup@2.79.1_solid-js@1.8.8_vinxi@0.1.1_vite@4.5.1/node_modules/@solidjs/start/shared/dev-overlay/CodeView.tsx:80:11 - error TS18048: 'el' is possibly 'undefined'.

80           el.innerHTML = `<mark style="background-color:#aaaaaa80">${el.innerHTML}</mark>`;
             ~~

node_modules/.pnpm/@solidjs+start@0.4.4_rollup@2.79.1_solid-js@1.8.8_vinxi@0.1.1_vite@4.5.1/node_modules/@solidjs/start/shared/dev-overlay/CodeView.tsx:80:70 - error TS18048: 'el' is possibly 'undefined'.

80           el.innerHTML = `<mark style="background-color:#aaaaaa80">${el.innerHTML}</mark>`;
                                                                        ~~

node_modules/.pnpm/@solidjs+start@0.4.4_rollup@2.79.1_solid-js@1.8.8_vinxi@0.1.1_vite@4.5.1/node_modules/@solidjs/start/shared/dev-overlay/get-source-map.ts:14:20 - error TS2532: Object is possibly 'undefined'.

14     const result = lines[i].match(SOURCEMAP_REGEX);
                      ~~~~~~~~

Expected behavior 🤔

.d.ts files should be built and pointed to in types, exports and typesVersions in package.json.
Source files should still be pointed to for conditional exports such as import and export.
Prior art includes Solid Router and Kobalte.

Steps to reproduce 🕹

Steps:

  1. Open stackblitz
  2. Wait for packages to install
  3. Run pnpm tsc
  4. Observe a lot of errors from @solidjs/router even though skipLibCheck is enabled

Context 🔦

I like doing monorepo-wide typechecking with pnpm tsc -b, but these errors get in the way. I can just run the command from packages that don't depend on @solidjs/start in the meantime.

Your environment 🌎

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions