Skip to content

Module request specifier for a non JS file does not pick up matching definition files #49970

Closed
@tomrav

Description

@tomrav

Bug Report

.d.ts files are not picked up for files that do not contain a .js extension in the module request specifier.

This happens when using the following configuration:

  • "moduleResolution": "node16" in tsconfig.json
  • "type": "module" in package.json

🔎 Search Terms

definition files, non js, third party

🕗 Version & Regression Information

This reproduces on version 4.7.4, but I think this issue exists since TypeScript began supporting "type": "module" configuration.

  • This is the behavior in every version I tried, and I reviewed the FAQ for entries about definition files

⏯ Playground Link

No playground as this reproduction requires multiple files.

💻 Code

Minimal reproduction repo - https://github.com/barak007/type-module-ts-bug

🙁 Actual behavior

The component.ts file, imports the component.st.css file, but the component.st.css.d.ts file is not picked up, and the import is not resolved.

🙂 Expected behavior

Pick up the module definition for the .st.css file and allow using it.

Metadata

Metadata

Assignees

Labels

Needs InvestigationThis issue needs a team member to investigate its status.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions