long.js icon indicating copy to clipboard operation
long.js copied to clipboard

Change source of truth for types to umd/index.d.ts to resolve issue with typescript import in 5.x (Resolves #109)

Open SimplyLinn opened this issue 1 year ago • 7 comments

The previous PR to resolve this issue (#124) ended up duplicating the types to the umd module.

Moving the source-of-truth to the ./umd/index.d.ts file enables the ./index.d.ts file to import the class from the umd subdirectory with no issues. The other way around, however, seems to be the cause of the issues.

My suggestion is to move the source of truth to the umd declaration file, and import it from the root index.d.ts, as to avoid duplicated code, while still keeping the types functional.

This would resolve #109

SimplyLinn avatar Nov 22 '23 10:11 SimplyLinn

@dcodeIO hello! Could you review the PR?

arnidan avatar Jan 18 '24 13:01 arnidan

Have ya'll verified that the proposed change indeed works for both ESM and CJS/UMD?

dcodeIO avatar Jan 18 '24 17:01 dcodeIO

@dcodeIO we're trying to move a project from CJS to ESM, and it looks like if we swap the imports like in this PR, it works in both CJS and ESM.

alecgibson avatar Jan 19 '24 16:01 alecgibson

Would love to get this merged! 🙏

TangrisJones avatar Feb 06 '24 04:02 TangrisJones

Also would love to get this merged. Requires we enable skipLibCheck which we don't love

yinzara avatar Feb 06 '24 18:02 yinzara

@dcodeIO Were you able to review this? We need this fix. I have tested it as well and it works fine.

aakasheoran avatar Mar 28 '24 16:03 aakasheoran

Any news ?

gillg avatar Jun 05 '24 00:06 gillg