Skip to content

Types are not available for CJS modules when using modern moduleResolutions #1787

@Andarist

Description

@Andarist

Describe the bug

This input code:

// @moduleResolution: node16
// @module: commonjs
import {} from 'solid-js' // types: 1.7.6

results in

Cannot find module 'solid-js' or its corresponding type declarations.(2307)

You can also verify this here: https://arethetypeswrong.github.io/?p=solid-js%401.7.6

Your Example Website or App

https://www.typescriptlang.org/play?moduleResolution=3&target=99&module=1&ssl=3&ssc=42&pln=1&pc=1#code/PTAEAEFsHsBMFcA2BTASsgztR8AuBLaAOwC5Qi5kBGANgCgQIYEUyBjaSGIgKwzvyQADtABOuUAG8AvqABmozqADkWRPlgBaPstCNcATyGYyVAHQB2MzSA

Steps to Reproduce the Bug or Issue

Configure the tsconfig.json using the mentioned options

Expected behavior

Since at runtime I can require('solid-js'), I should be also able to load types in code configured to emit as CJS

Screenshots or Videos

No response

Platform

N/A

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions