Skip to content
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

TS emit failed with latest release #765

Closed
tomitrescak opened this issue Dec 4, 2015 · 28 comments
Closed

TS emit failed with latest release #765

tomitrescak opened this issue Dec 4, 2015 · 28 comments
Assignees
Labels

Comments

@tomitrescak
Copy link

The build works as expected, but when compilation on save is emited following error is triggered:

screen shot 2015-12-04 at 10 48 20

@basarat basarat added the bug label Dec 4, 2015
@basarat basarat self-assigned this Dec 4, 2015
@basarat
Copy link
Member

basarat commented Dec 4, 2015

The build works as expected, but when compilation on save is emited following error is triggered:

Sorry @tomitrescak. I tried a quick test and it works fine.

asdfasdf

Can you share your tsconfig.json ... and are you using extenalTranspiler? (I'm personally not and don't even have it setup) 🌹

@basarat
Copy link
Member

basarat commented Dec 4, 2015

Got it. Happens if the file is a .d.ts file ... aka doesn't have a valid js status

@basarat
Copy link
Member

basarat commented Dec 4, 2015

Released: https://github.com/TypeStrong/atom-typescript/releases/tag/v7.14.0 have a nice weekend 🌹

@tomitrescak
Copy link
Author

I admire your speeeeeeeeeeed 🎱 ;)

@laurelnaiad
Copy link

I suspect it's possible that the failures with d.ts files might be similar to the issue I'm chasing in #755. @tomitrescak (and @basarat ) when you were experiencing (and reproducing) this bug, were you compiling into your source directory? Or targeting a build directory distinct from your source directory? #755 popped up for me when I was looking at other babel-related code, as well. I will respond to @basarat's request for followup over in that thread now.

By the way, I totally get why reverting the babel thing makes sense for now. Those of us using babel can still use that commit until it's better sorted out. I think there are a few other issues with the babel integration that might as well all get packaged up together properly, rather than trying to piecemeal them as hotfixes to the babel support.

@tomitrescak
Copy link
Author

[EDIT] - Nevermind what is written below .. I had downgraded atom-typescript to previous version, therefore I had no errors. I will keep on investigating.

Hi, 7.14.1 is still failing Emit ;( Last one that works is 7.12.0 ;(
I am not emiting files as per my tsconfig ... but I get the TS Emit failed message :/


  "compileOnSave": true,
  "compilerOptions": {
    "target": "es6",
    "declaration": false,
    "noImplicitAny": true,
    "removeComments": false,
    "noLib": false,
    "preserveConstEnums": true,
    "noEmitHelpers": true,
    "noEmit": true,
    "suppressImplicitAnyIndexErrors": true,
    "jsx": "preserve",
    "experimentalDecorators": true,
    "experimentalAsyncFunctions": true,
    "sourceMap": true
  },
  "awesomeTypescriptLoaderOptions": {
    "doTypeCheck": true,
    "useBabel": false,
    "emitRequireType": true,
    "forkChecker": true
  },
  "filesGlob": [
    "modules/**/*.ts",
    "modules/**/*.tsx"
  ],
  "files": [
...
  ],
  "exclude": [
    "node_modules"
  ],
  "atom": {
    "rewriteTsconfig": true
  }
}

@basarat basarat reopened this Dec 6, 2015
@basarat
Copy link
Member

basarat commented Dec 6, 2015

Hi, 7.14.1 is still failing Emit ;(

@tomitrescak I believe the stack trace would now be different. Can you share that please 🌹

@tomitrescak
Copy link
Author

Bad news ;( Stacktrace is empty .. no error in console. Only the TS failed to emit error.

@basarat
Copy link
Member

basarat commented Dec 11, 2015

ad news ;( Stacktrace is empty .. no error in console. Only the TS failed to emit error.

@tomitrescak I don't have a repro :-/ Also you seem to be the only one suffering from this at the moment. I am open to suggestions 🌹

working fine

@tomitrescak
Copy link
Author

@basarat GOT IT!

The culprit is the "noEmit": true

With compilation set to some outDir no problems appear.
When I turn on the noEmit rule in any of my projects I receive the TS Emit Failed.

I can reproduce this issue in ALL my projects, please test it if you have time.

@basarat
Copy link
Member

basarat commented Dec 13, 2015

The culprit is the "noEmit": true

Wouldn't noEmit explicitly disable any emit? So we shouldn't show the message but the rest is fine? Am I mistaken? 🌹

@tomitrescak
Copy link
Author

Yes, you are right. I'm not sure if on-the-fly compilation does the same as compilation on save, but the Emit Failed message should not be shown as it is a bit misleading since compilation is performed just fine.

laurelnaiad pushed a commit to laurelnaiad/atom-typescript that referenced this issue Dec 13, 2015
This commit needs to be fixed up and documented -- not ready for merge
-- but seems to improve
some things regarding emits as well as having fixes for
externalTranspiler/babel support.

Because many tranpiles are synchronous, the main feature of these
changes is to make externalTranipilation synchronous so as not to fall
out of the event loop, but it also makes some changes to emit handling
and tranpile error handling/reporting.

It might help with issues such as TypeStrong#737 and perhaps even TypeStrong#765 (it
doesn't exhibit the Emit Failed symptoms even with noEmit: true).

For now, it doesn't close any issues. It's also behin master, so
certainly beware.
laurelnaiad pushed a commit to laurelnaiad/atom-typescript that referenced this issue Dec 13, 2015
This commit needs to be fixed up and documented -- not ready for merge
-- but seems to improve
some things regarding emits as well as having fixes for
externalTranspiler/babel support.

Because many tranpiles are synchronous, the main feature of these
changes is to make externalTranipilation synchronous so as not to fall
out of the event loop, but it also makes some changes to emit handling
and tranpile error handling/reporting.

It might help with issues such as TypeStrong#737 and perhaps even TypeStrong#765 (it
doesn't exhibit the Emit Failed symptoms even with noEmit: true).

For now, it doesn't close any issues. It's also behin master, so
certainly beware.
@basarat
Copy link
Member

basarat commented Dec 13, 2015

@tomitrescak I've created a clearer issue report : #780 🌹

@basarat basarat closed this as completed Dec 13, 2015
@tomitrescak
Copy link
Author

@basarat I still get TS Emit failed when emit is set to false ;(

@basarat
Copy link
Member

basarat commented Jan 11, 2016

@tomitrescak the issue still exits : #780

I have difficulty wrapping my head around why one would even need noEmit : true? Surely something must be doing the emit and that thing is effectively ignoring the noEmit option. What is that thing? 🌹

@laurelnaiad
Copy link

My entire build process uses gulp-typescript and gulp-babel... including building the build itself -- so that no particular editor is needed, and so that we can control the streams, etc. etc. It also transpiles itself.

I always run with noEmit: true now.

(gulp-typescript happily, and correctly-for-its-use-case ignores the noEmit flag)

@basarat
Copy link
Member

basarat commented Jan 11, 2016

Cool so gulp-typescript ignores noEmit (https://www.npmjs.com/package/gulp-typescript#options). If all you want is just atom to ignore emit perhaps use compileOnSave: false as a workaround till the issue is fixed 🌹

@laurelnaiad
Copy link

Right -- difference being that the compile/buildOnSave settings prevent editor from assisting you in typechecking in-window.

I don't actually have an issue with noEmit anymore on my branch, so somewhere in there I think there's a fix (though maybe not an ideal one). I still need to deal with making that into a PR or PRs.

So, I don't need a workaround right now -- I was just chiming in with a reasoning behind wanting to run atom-typescript with noEmit turned on.

@tomitrescak
Copy link
Author

@basarat I am running Webpack with ts-loader which is responsible for loading typescript and creating sourcemaps. Thereofre I do not need emission. I need compile on save to have the possibility of typechecks and more.

@basarat
Copy link
Member

basarat commented Jan 12, 2016

I need compile on save to have the possibility of typechecks and more.

Typechecks are performed irrespective of compileOnSave (code

// Compile on save
parent.getProjectFileDetails({ filePath: event.filePath }).then(fileDetails => {
if (fileDetails.project.compileOnSave
&& !fileDetails.project.compilerOptions.out
&& !fileDetails.project.buildOnSave) {
textUpdated.then(() => parent.emitFile({ filePath: event.filePath }))
.then((res) => {
let status = getFileStatus(event.filePath);
status.modified = false;
// If there was a compilation error, the file differs from the one on the disk
status.emitDiffers = res.emitError;
panelView.updateFileStatus(event.filePath);
errorView.showEmittedMessage(res);
});
}
if (fileDetails.project.buildOnSave) {
// Trigger a build ;)
atom.commands.dispatch(
atom.views.getView(event.editor),
'typescript:build');
}
});
). Correct me if I am wrong 🌹

laurelnaiad pushed a commit to laurelnaiad/atom-typescript that referenced this issue Jan 14, 2016
This commit needs to be fixed up and documented -- not ready for merge
-- but seems to improve
some things regarding emits as well as having fixes for
externalTranspiler/babel support.

Because many tranpiles are synchronous, the main feature of these
changes is to make externalTranipilation synchronous so as not to fall
out of the event loop, but it also makes some changes to emit handling
and tranpile error handling/reporting.

It might help with issues such as TypeStrong#737 and perhaps even TypeStrong#765 (it
doesn't exhibit the Emit Failed symptoms even with noEmit: true).

For now, it doesn't close any issues. It's also behin master, so
certainly beware.
laurelnaiad pushed a commit to laurelnaiad/atom-typescript that referenced this issue Jan 14, 2016
This commit needs to be fixed up and documented -- not ready for merge
-- but seems to improve
some things regarding emits as well as having fixes for
externalTranspiler/babel support.

Because many tranpiles are synchronous, the main feature of these
changes is to make externalTranipilation synchronous so as not to fall
out of the event loop, but it also makes some changes to emit handling
and tranpile error handling/reporting.

It might help with issues such as TypeStrong#737 and perhaps even TypeStrong#765 (it
doesn't exhibit the Emit Failed symptoms even with noEmit: true).

For now, it doesn't close any issues. It's also behin master, so
certainly beware.
@slavik57
Copy link

slavik57 commented Mar 5, 2016

I don't know if it is relevant, but I got the same error,
I figured out why I got it, the problem for me was that the d.ts files of the project were included in the tsconfig.json/files section
so I added them to the tsconfig.json/exclude section and it worked out for me:
"exclude": [
"src/*/.d.ts",
"index.d.ts",
...
]

Hope it helps

@n9
Copy link

n9 commented Apr 13, 2016

In my case, I have resolved TS emit failed message by removing "noEmitOnError": true from tsconfig.json:

{
  "compileOnSave": true,
  "compilerOptions": {
    "noImplicitAny": false,
    "noEmitOnError": true,
    "removeComments": false,
    "sourceMap": true,
    "target": "es5",
    "module": "system",
    "jsx": "react",
    "experimentalDecorators": true
  },
  "exclude": [
    "typings",
    "node_modules",
    "jspm_packages",
    "wwwroot"
  ]
}

The tsconfig.json above is taken from this guide. It works ok in VS2015 but not in Atom.

But, I am not sure whether this is related to this issue.

@sharpmachine
Copy link

Any progress on this bug? It's hella annoying.

@ghost
Copy link

ghost commented Aug 17, 2016

bug still there so please fix

@tskweres
Copy link

tskweres commented Oct 3, 2016

still there, any ideas whatsup?

@xiongemi
Copy link

xiongemi commented Nov 7, 2016

I got the same issue, too. Using Atom 1.10.2.

@josemera
Copy link

same here, when setting "noEmitOnError": true, I get the 'TS Emit Failed' message when saving even if there are no actual errors. I can compile the file on the command line with tsc and everything works fine, but not from Atom.

@sharpmachine
Copy link

I solved this issue by switching from Atom to VS Code. Atom was sweet, but VS Code is sweeter.

@TypeStrong TypeStrong locked and limited conversation to collaborators Jan 20, 2019
angelestelar5z added a commit to angelestelar5z/atom-typescript that referenced this issue Aug 17, 2024
 TypeStrong/atom-typescript#765 which takes priority over babel compile experience 🌹

This reverts commit 5103cec.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

9 participants