Skip to content

Conversation

@swapnil-nagar
Copy link
Contributor

@swapnil-nagar swapnil-nagar commented Jan 2, 2026

Overivew
When library .d.ts files import .ts files, those .ts files are included in the compilation step of the user projects. For example, since index.d.ts imports toolProperties.ts here, toolProperties.ts will be compiles as part of the user project

This is problematic since file may not compile under tsconfig.json settings of the user

For example, this library is targets CJS, but uses ESM syntax (export). If users use verbatimModuleSyntax: true - which requires that CJS files use CJS syntax - their compilation will fail, with no easy fix

Similarly, if users if users use any strict* option this project doesn't, toolProperties.ts may not compile

Effectively, toolProperties.ts of this library limits what tsconfig.json settings users can use

Expected behavior
Library's .d.ts files may import only other .d.ts files, but not .ts files

Actual behavior
index.d.ts imports toolProperties.ts here

Example user project that fails to compile due to this: https://github.com/azerum/azure-functions-type-check-bug

Suggested fix
Generate .d.ts file for toolProperties.ts and export that. I am not familiar with why .d.ts files of this library are written manually and not generated from .ts files, I assume there must be a good reason..

@swapnil-nagar swapnil-nagar requested a review from a team as a code owner January 2, 2026 21:45
hallvictoria
hallvictoria previously approved these changes Jan 5, 2026
@TsuyoshiUshio
Copy link

Hi @swapnil-nagar The change totally makes sense. Leave small nit. but I'd happy to approve.
One question is, do you have issue that related this PR? If so, let's link it.

@VanTanev
Copy link

VanTanev commented Jan 6, 2026

Hi @swapnil-nagar The change totally makes sense. Leave small nit. but I'd happy to approve. One question is, do you have issue that related this PR? If so, let's link it.

Not op, but an issue exists: #397

Copy link

@TsuyoshiUshio TsuyoshiUshio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@swapnil-nagar swapnil-nagar enabled auto-merge (squash) January 6, 2026 21:02
@swapnil-nagar swapnil-nagar merged commit 258fba7 into v4.x Jan 6, 2026
15 checks passed
@swapnil-nagar swapnil-nagar deleted the alias/swapnil/fixingVerbitiam branch January 6, 2026 21:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants