-
Notifications
You must be signed in to change notification settings - Fork 12.4k
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
Source code transpiles, but emitted declarations filled with errors #24876
Comments
I think the problem is around the The source looks like this, ColumnReferencesUtil.Merge<
RawExprUtil.UsedReferences<LeftT>,
RawExprUtil.UsedReferences<RightT>
> But the emitted declaration that has errors looks like this, (LeftT extends RawExprUtil.WithParentJoins ? true extends LeftT["data"]["hasParentJoins"] ? LeftT["data"]["parentJoins"][Extract<keyof LeftT["data"]["parentJoins"], "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "13" | "14" | "15" | "16" | "17" | "18" | "19" | "20" | "21" | "22" | "23" | "24" | "25" | "26" | "27" | "28" | "29" | "30">] extends Join<AliasedTable<string, string, import("../column-collection/column-collection").ColumnCollection>, import("../column-collection/column-collection").ColumnCollection, boolean> ? LeftT["data"]["parentJoins"][Extract<keyof LeftT["data"]["parentJoins"], "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "13" | "14" | "15" | "16" | "17" | "18" | "19" | "20" | "21" | "22" | "23" | "24" | "25" | "26" | "27" | "28" | "29" | "30">]["table"] extends AliasedTable<string, string, import("../column-collection/column-collection").ColumnCollection> ? { readonly [tableAlias in LeftT["data"]["parentJoins"][Extract<keyof LeftT["data"]["parentJoins"], "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "13" | "14" | "15" | "16" | "17" | "18" | "19" | "20" | "21" | "22" | "23" | "24" | "25" | "26" | "27" | "28" | "29" | "30">]["table"]["alias"]]: { [index in Extract<keyof LeftT["data"]["parentJoins"], "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "13" | "14" | "15" | "16" | "17" | "18" | "19" | "20" | "21" | "22" | "23" | "24" | "25" | "26" | "27" | "28" | "29" | "30">]: LeftT["data"]["parentJoins"][index] extends Join<AliasedTable<string, string, import("../column-collection/column-collection").ColumnCollection>, import("../column-collection/column-collection").ColumnCollection, boolean> ? LeftT["data"]["parentJoins"][index]["table"]["alias"]
/*snip many, many, many, many, many more lines of code*/ Among the errors,
I don't know why it's doing the expansion and why it works fine without the expansion but breaks with it. Is there a way to make |
I just updated to
One of the new types of errors is,
The directory structure is,
So, But if I manually fix the emitted declaration by changing it to import |
I ran a replace on all the emitted And it looks like the errors are back to the way they were on
|
Looks like we're using the baseUrl to generate a nonrelative specifier, except ofc consumers dont share a baseUrl inside your package. Probably need to ignore baseUrl when generating .d.ts import paths. Plus the structural decomposition thing. |
Actually, I'm pretty sure those paths are the expected and desired output when |
I copy-pasted the I removed the Sorry about that. In fact, I think the |
I got it. AnyhowStep/typed-orm@eecbd43#diff-e4ac64f1d2caf8dc20405612f17c6d62 After so long, I finally got my project to transpile, and have another project successfully use it and transpile, too. The change is in I basically just spammed Before, I just had checks like these, X extends Y ?
X :
never These worked for My solution is roughly, X extends Y ?
Extract<X, Y> :
never And it works for |
Yuuuuuuuuuuuuuuuuuuuuuuup. The constraints applied in the true branch by a |
Random question; are these types the same? (They seem to be) X extends Y ? Extract<X, Y> : never And Extract<X, Y> |
I apologize if I shouldn't be opening an issue about this.
I asked about debugging long compile times before in another issue, #24435
This issue right now is related to that but in a different way.
The
typed-orm
project transpiles quickly now, after an unintuitive solution, but the emitted declarations appear "unusable" by other projects (at least according totsc
).ts-node
and VS code don't seem to have a problem with the emitted declarations and seem to run just fine.TypeScript Version: 2.9.1
Search Terms: emit declarations incorrect
Code
And then run
tsc --noEmit --diagnostics
A repo that reproduces the problem can be found here
Expected behavior:
Success after about 17 seconds
Actual behavior:
Errors after about 37s
The list of errors is... Rather large.
I have a different project that is using
typed-orm
andts-node
seems to run it fine. VS code also seems to do some type checking fine (seems to, maybe it skips some more involved checks, or does incremental checking, I have no idea).However, when I try to run
tsc
(checking types/transpiling),node
just runs out of memory, even after giving it 8GB of RAM.I tried to debug what was wrong. The
typed-orm
project itself transpiles very quickly, now. I figured there must be something wrong with that project. However, after removing a lot of code, I still got out-of-memory exceptions.In the end, I created an entirely new project, wrote that snippet above, and saw that even though the source code for
typed-orm
transpiles, the transpiled declarations seem to have errors.Link to example: here
Link to
typed-orm
: hereRelated Issues: #24435
The text was updated successfully, but these errors were encountered: