-
Notifications
You must be signed in to change notification settings - Fork 27
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
Fix types
path and make linter yell
#922
Conversation
🦋 Changeset detectedLatest commit: c253604 The changes in this PR will be included in the next version bump. This PR includes changesets to release 16 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 5 Ignored Deployments
|
c7ec451
to
25f6b15
Compare
@@ -24,7 +24,7 @@ | |||
} | |||
], | |||
"main": "lib/index.js", | |||
"types": "lib/index.d.ts", | |||
"types": "dist/pactjs.d.ts", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one causes trouble:
[typescript] Encountered 2 TypeScript issues:
[typescript] Error: src/tests/mkCap.test.ts:54:57 - (TS2339) Property 'toPactInteger' does not exist on type 'PactNumber'.
[typescript] Error: src/tests/mkCap.test.ts:55:62 - (TS2339) Property 'toPactDecimal' does not exist on type 'PactNumber'.
---- Compile encountered an error (1577ms) ----
-------------------- Finished (1.756s) --------------------
Encountered 2 errors:
[typescript] src/tests/mkCap.test.ts:54:57 - (TS2339) Property 'toPactInteger' does not exist on type 'PactNumber'.
[typescript] src/tests/mkCap.test.ts:55:62 - (TS2339) Property 'toPactDecimal' does not exist on type 'PactNumber'.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The issue is probably caused by the triple slash directive in PactNumber.ts
that ends up in lib/PactNumber.d.ts
, but not in dist/pactjs.d.ts
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
API Extractor seems to not handle the triple slash directive:
/// <reference path="./extend-bignumber.ts" />
It's just gone (I think it should inline extend-bignumber.ts
). To me this seems normal and valid usage of TypeScript. AE seems to support only types
and lib
references.
I did try a few things with files
in tsconfig.json
and bundledPackages
in api-extractor.json
, but to no avail.
Not proud of it, but this does seem to do the trick:
"build": "heft build --clean && cat src/extend-bignumber.ts >> dist/pactjs.d.ts"
There are other ways around this, but making exceptions to the types": "dist/[pkg].d.ts"
rule or other TypeScript hacks to me sound even worse.
Any ideas welcome, though!
If we don't come up with a real fix and merge this I could open an issue in the rushstack repo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we add the contents of extend-bignumber.ts
in PactNumber.ts
, would that work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately not, declaration gets stripped, not sure how to work around this.
5e23758
to
b828c4c
Compare
b828c4c
to
1c8eb92
Compare
Why? I'd rather use a file generated by typescript itself. it also come with a source map file.
|
This was a request from @alber70g. You can look at https://api-extractor.com for some reasoning under "DTS rollup". It makes sense, until we hit issues like in this PR. Tbh not a fan myself, just using |
we already use all of the good aspects of it. but by using it in the package.json will break source mapping. |
packages/tools/cookbook/package.json
Outdated
@@ -7,6 +7,7 @@ | |||
"license": "ISC", | |||
"author": "", | |||
"main": "index.js", | |||
"types": "dist/cookbook.d.ts", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this one doesn't exist, since there's no heft-build right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, I've also removed this config/api-extractor.json
packages/apps/graph/package.json
Outdated
@@ -7,6 +7,7 @@ | |||
"license": "ISC", | |||
"author": "", | |||
"main": "index.js", | |||
"types": "dist/graph.d.ts", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it make sense to have this? It's a private package, that's not going to be used in code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, I've also removed this config/api-extractor.json
@@ -24,7 +24,7 @@ | |||
} | |||
], | |||
"main": "lib/index.js", | |||
"types": "lib/index.d.ts", | |||
"types": "dist/pactjs.d.ts", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we add the contents of extend-bignumber.ts
in PactNumber.ts
, would that work?
The
"types"
field should point to what API Extractor generates in thedist
folder.There is one issue though, added a note.