-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
tsc --watch regression in Typescript 1.8 Beta #6941
Comments
What version of node are you running? What os? And are any files that are watched correctelly? |
Good questions: |
Upgrading to Node: v5.5.0 didn't seem to make a difference. |
@billti do you see a similar behavior? i do not see issues on v.5.5.0 on windows. |
I just installed Node v5.5.0 and created a simple project with no issues. I added a .tsx file, tried with a couple of different "jsx" settings, and I'm using the latest OS X (10.11.3) but it seems unlikely this is the cause. Anything beyond a very typical setup that might be causing this? If you create a new super-simple project with only a couple of files do you see the same problem? |
I don't have an outDir specified: {
"compilerOptions": {
"target": "ES5",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"jsx": "react",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": false,
"preserveConstEnums": true
},
"exclude": [
"node_modules",
"bower_components"
]
} I'll see if I can create a small sample project. |
I have made a project that seems to break: tsc-watch Install:
Everything should build without warnings or errors. Choose test/test.ts file to edit. Cheers, |
This project is working fine for me on my Windows box. @vladima can you give tsc--w on Ubuntu a try as well. |
To be clear, tsc -w picks up new files. But it does not pick up changes to existing files. |
Ubuntu 15.10
Please let me know if anything is missed or you've done it differently. |
I wonder if it is a case-sensitive issue. OSX is case-insensitive. I believe Ubuntu is case-sensitive. I had a brief look at the code that changed around the watcher and it looked like there were different code paths for case-sensitive vs case-insensitive. |
#6511 was a change related to case sensitivity. but that was fixed a while ago. we have not touched this code since. do you see this on other machines? is it all projects? does it happen with no tsconfig.jon (e.g. tsc --w file.ts)? |
Same problem here on OSX 10.11.3. |
I found the issue. The issue is with how changes are tracked in: sys.ts:fileEventHandler Here is why I see it and other people are not.
sys.ts function fileEventHandler(eventName: string, relativeFileName: string, baseDirPath: Path) {
// When files are deleted from disk, the triggered "rename" event would have a relativefileName of "undefined"
const filePath = typeof relativeFileName !== "string"
? undefined
: toPath(relativeFileName, baseDirPath, createGetCanonicalFileName(sys.useCaseSensitiveFileNames));
if (eventName === "change" && fileWatcherCallbacks.contains(filePath)) {
for (const fileCallback of fileWatcherCallbacks.get(filePath)) {
fileCallback(filePath);
}
}
} the fix is to correctly handle "rename" events. Simple Repro steps:
Expected that the new |
@Jason-Rev Good catch! I'm using IntelliJ. |
Trivially changing the test to (eventName === "change" || eventName == "rename") seems to work but also produces a scary error:
|
Looks like a very lengthy write-up of the cause of that exception at https://github.com/bdkjones/fseventsbug/wiki/realpath()-And-FSEvents . (Found by a reference to it on a related Node issue - nodejs/node#854 ). Will did into this a little more and see what the best solution might be... |
I've spent a couple hours on this, and I've been unable to repro the scary There was also a bug in how |
@billti Yeah, the Reading the article you linked to, it seems to be a random problem with the filesystem so typescript should probably not worry about it. Moreover, the compiler seem to work fine even with the error message showing. Sorry if it has caused confusion. |
Thank you @billti. I'll verify that your fix worked and close later today. |
Thanks. This is merged into release-1.8 and master now. Add a comment if you still see any issues (other than the benign OS X message) and I'll reopen. |
With the beta version of 1.8 installed using:
tsc --watch from project root does not appear to be working. It compiles once but any subsequent changes to the files has no effect.
going back to 1.7.5, everything works fine.
This seems related to #6511.
npm install typescript@next which gets version 1.9.0 also does not seem to be working.
The text was updated successfully, but these errors were encountered: