Skip to content

No .d.ts Declaration Files for JS Files Are Emitted (allowJs: true) #1260

Closed
@hediet

Description

@hediet

When setting allowJs: true in tsconfig.json, typescript files can import javascript files.
Typescript is also clever about the types used in javascript and infers as much as possible.
Such inferred javascript types might even be exported by typescript files and become part of the library API.

Expected Behaviour

ts-loader should emit declaration files for javascript files when allowJs is set to true and ts-loader is configured to handle javascript files.

Actual Behaviour

ts-loader does not emit declaration files for javascript files that are imported in typescript files. This results in broken declaration files.

Steps to Reproduce the Problem

  1. clone https://github.com/hediet/webpack-allowjs-declaration-issue-repro
  2. run yarn
  3. run yarn build
  4. Notice this error (no declaration files for javascript):

image

Location of a Minimal Repository that Demonstrates the Issue.

https://github.com/hediet/webpack-allowjs-declaration-issue-repro

Btw., thanks for creating and maintaining ts-loader!

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