-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🚀 Feature: Export types #531
Comments
Ah, I would have thought this would have already been done by #209. Definitely a bug that should be fixed. Thanks for filing! |
@all-contributors please add @joel-daros for ideas.
|
I've put up a pull request to add @joel-daros! 🎉 I couldn't determine any contributions to add, did you specify any contributions? |
Adds @joel-daros as a contributor for ideas. This was requested by JoshuaKGoldberg [in this comment](#531 (comment)) --------- Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
@JoshuaKGoldberg I was inspecting this issue and it looks like there is something related to the package release action. The build process is generating the types correctly in the I don’t know if there is anything related but, the code published in the npm isn’t actually the code built in |
Interesting! I also see the published package doesn't have provenance noted, the way more recent Let me refresh the tooling now, publish a new patch version, and see where that goes... |
## PR Checklist - [x] Addresses an existing open issue: fixes #531 - [x] That issue was marked as [`status: accepting prs`](https://github.com/JoshuaKGoldberg/console-fail-test/issues?q=is%3Aopen+is%3Aissue+label%3A%22status%3A+accepting+prs%22) - [x] Steps in [CONTRIBUTING.md](https://github.com/JoshuaKGoldberg/console-fail-test/blob/main/.github/CONTRIBUTING.md) were taken ## Overview Runs `npx create-typescript-app --auto --mode migrate`. Also runs an `ncu -u` for everything (except `eslint`, as `typescript-eslint` doesn't support ESLint v9 in stable yet). This doesn't actually change build settings directly. But I'm betting that getting all build-related packages up-to-date will resolve any build oddities.
Ok looks like the import { cft } from "console-fail-test";
cft(); // This is typed now, hooray! Thanks for the issue @joel-daros, I'm a bit relieved that this is working! |
I really appreciate the fixes @JoshuaKGoldberg , but I think we still have an issue that is preventing the types from working correctly. There are no errors in the TS playground, but when the package is installed locally in a real project, it still complains about missing types for I think the way you’re exposing the "exports" types in "exports": {
".": {
"types": {
"import": "./lib/index.d.mts",
"require": "./lib/index.d.ts"
},
"import": "./lib/index.mjs",
"require": "./lib/index.js"
}
}, I made some changes in my local env and looks like the changes bellow solve the issue: "exports": {
".": {
"import": {
"types": "./lib/index.d.ts",
"default": "./lib/index.js"
},
"require": {
"types": "./lib/index.d.cts",
"default": "./lib/index.cjs"
}
}
}, I’ll be happy to submit a PR with these changes if you agree that’s right way to solve it. |
...and you're right @joel-daros - I was only checking the one module resolution mode on the playground. A PR would be lovely, yes please! |
<!-- 👋 Hi, thanks for sending a PR to console-fail-test! 💖. Please fill out all fields below and make sure each item is true and [x] checked. Otherwise we may not be able to review your PR. --> ## PR Checklist - [X] Addresses an existing open issue: fixes #531 - [X] That issue was marked as [`status: accepting prs`](https://github.com/JoshuaKGoldberg/console-fail-test/issues?q=is%3Aopen+is%3Aissue+label%3A%22status%3A+accepting+prs%22) - [X] Steps in [CONTRIBUTING.md](https://github.com/JoshuaKGoldberg/console-fail-test/blob/main/.github/CONTRIBUTING.md) were taken ## Overview Fixed an issue regarding the exported types definitions in the `package.json` : ```shell $ npx -y @arethetypeswrong/cli -P console-fail-test v0.4.0 Build tools: - typescript@5.5.3 - tsup@8.1.0 No problems found 🌟 ┌───────────────────┬─────────────────────┐ │ │ "console-fail-test" │ ├───────────────────┼─────────────────────┤ │ node10 │ 🟢 │ ├───────────────────┼─────────────────────┤ │ node16 (from CJS) │ 🟢 (CJS) │ ├───────────────────┼─────────────────────┤ │ node16 (from ESM) │ 🟢 (ESM) │ ├───────────────────┼─────────────────────┤ │ bundler │ 🟢 │ └───────────────────┴─────────────────────┘ ``` 💖 Co-authored-by: Joel Daros <joel.daros@corteva.com>
🎉 This is included in version v0.4.1 🎉 The release is available on: Cheers! 📦🚀 |
Bug Report Checklist
main
branch of the repository.Overview
I’m testing
console-fail-test
in one of our projects within our monorepo.Our Vitest env is configured using a single
vitest.config
file pointing to asetupTest.ts
file inside each monorepo project, so I can’t change the shared vitest config, because it will affect all projects.Note that my
setupTest.ts
is a TS file, so when I’m importingconsole-fail-test
TS is complaining about missing declaration types for this package:As a workaround I had to add a couple of TS and Eslint ignores to bypass this issue:
Additional Info
No response
The text was updated successfully, but these errors were encountered: