question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Source code transpiles, but emitted declarations filled with errors

See original GitHub issue

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 to tsc).

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

import * as o from "typed-orm";
o;

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 and ts-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: here

Related Issues: #24435

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
weswighamcommented, Jul 6, 2018

Actually, I’m pretty sure those paths are the expected and desired output when baseUrl is set, given that baseUrl is for multiproject/application scenarios (so you say baseUrl is your workspace root, then use nonrelative paths for each workspace folder). Why do you have baseUrl set in your tsconfig; with a quick look I can’t find any paths in your application that should rely on it to work?

0reactions
AnyhowStepcommented, Aug 9, 2018

Random question; are these types the same? (They seem to be)

X extends Y ? Extract<X, Y> : never

And

Extract<X, Y>
Read more comments on GitHub >

github_iconTop Results From Across the Web

I get an TS18003 error when compiling my typescript on VS ...
I try the command on my VS Code terminal: "npm run build" ... Emit design-type metadata for decorated declarations in source files.
Read more >
TSConfig Reference - Docs on every TSConfig option
Report errors for fallthrough cases in switch statements. Ensures that any non-empty case inside a switch statement includes either break or return ....
Read more >
Typescript – How to solve the problem with unresolved path ...
This error actually points to the transpiled('emitted') JavaScript .js file containing the line with the path alias. The actual cause of the ...
Read more >
Compiling and bundling TypeScript libraries with Webpack
ts types declarations + source maps (very handy for debugging the TS source code). Module syntax will be CommonJS for supporting the majority...
Read more >
ts-loader
Code Splitting and Loading Other Resources; Declarations (.d.ts); Failing the build on ... typescript has no choice but to emit the export.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found