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

False positive error messages after file rename #38684

Closed
robak86 opened this issue May 20, 2020 · 3 comments
Closed

False positive error messages after file rename #38684

robak86 opened this issue May 20, 2020 · 3 comments
Assignees
Labels
Bug A bug in TypeScript Fix Available A PR has been opened for this issue

Comments

@robak86
Copy link

robak86 commented May 20, 2020

TypeScript Version: 3.9.3

Search Terms:
"rename not found", "composite project not found"

Code

https://github.com/robak86/ts-issue

  1. Run yarn start (tsc in watch mode using -b flag for project references)
  2. The project compiles without errors
  3. Rename file. tsc displays an error that file was not found
  4. Restart tsc
  5. A different false positive error shows up

Expected behavior:
Renaming files work without errors

Actual behavior:
The renaming makes tsc display errors

Related Issues:
#37514

@robak86 robak86 changed the title False positive error messages after file remae False positive error messages after file rename May 20, 2020
@sheetalkamat
Copy link
Member

This doesnt seem to repro.. Can you share more details?
You can run tsc -b -v --extendedDiagnostics --listFiles --listEmittedFiles --watch and paste output here, may be that will reveal something.

@sheetalkamat sheetalkamat added the Needs More Info The issue still hasn't been fully clarified label May 20, 2020
@robak86
Copy link
Author

robak86 commented May 21, 2020

Sure, here is the run at which I renamed a file. I adjusted command to reflect my current setup (-b packages/tsconfig.json)

yarn tsc -b packages/tsconfig.json -v --extendedDiagnostics --listFiles --listEmittedFiles --watch
yarn run v1.22.4
$ /home/robak/Projects/ts-issue/node_modules/.bin/tsc -b packages/tsconfig.json -v --extendedDiagnostics --listFiles --listEmittedFiles --watch
[11:14:58 AM] Starting compilation in watch mode...

[11:14:58 AM] Projects in this build: 
    * packages/utils/tsconfig.json
    * packages/app/tsconfig.json
    * packages/tsconfig.json

[11:14:58 AM] Project 'packages/utils/tsconfig.json' is up to date because newest input 'packages/utils/src/index.ts' is older than oldest output 'packages/utils/lib/index.js.map'

[11:14:58 AM] Project 'packages/app/tsconfig.json' is out of date because oldest output 'packages/app/lib/index.js' is older than newest input 'packages/app/src/index.ts'

[11:14:58 AM] Building project '/home/robak/Projects/ts-issue/packages/app/tsconfig.json'...

/home/robak/Projects/ts-issue/node_modules/typescript/lib/lib.d.ts
/home/robak/Projects/ts-issue/node_modules/typescript/lib/lib.es5.d.ts
/home/robak/Projects/ts-issue/node_modules/typescript/lib/lib.dom.d.ts
/home/robak/Projects/ts-issue/node_modules/typescript/lib/lib.webworker.importscripts.d.ts
/home/robak/Projects/ts-issue/node_modules/typescript/lib/lib.scripthost.d.ts
/home/robak/Projects/ts-issue/packages/utils/lib/index.d.ts
/home/robak/Projects/ts-issue/packages/app/src/renameMe.ts
/home/robak/Projects/ts-issue/packages/app/src/index.ts
[11:14:58 AM] Updating unchanged output timestamps of project '/home/robak/Projects/ts-issue/packages/app/tsconfig.json'...

Files:                          8
Lines:                      24824
Nodes:                     111261
Identifiers:                40853
Symbols:                    24663
Types:                         76
Instantiations:                 0
Memory used:               46690K
Assignability cache size:       0
Identity cache size:            0
Subtype cache size:             0
Strict subtype cache size:      0
I/O Read time:              0.00s
Parse time:                 0.23s
ResolveTypeReference time:  0.00s
ResolveModule time:         0.00s
Program time:               0.23s
Bind time:                  0.12s
Total time:                 0.35s
[11:14:58 AM] Found 0 errors. Watching for file changes.

FileWatcher:: Added:: WatchInfo: /home/robak/Projects/ts-issue/packages/utils/tsconfig.json 2000 undefined Config file /home/robak/Projects/ts-issue/packages/utils/tsconfig.json
DirectoryWatcher:: Added:: WatchInfo: /home/robak/Projects/ts-issue/packages/utils 1 undefined Wild card directory /home/robak/Projects/ts-issue/packages/utils/tsconfig.json
Elapsed:: 1ms DirectoryWatcher:: Added:: WatchInfo: /home/robak/Projects/ts-issue/packages/utils 1 undefined Wild card directory /home/robak/Projects/ts-issue/packages/utils/tsconfig.json
FileWatcher:: Added:: WatchInfo: /home/robak/Projects/ts-issue/packages/utils/src/index.ts 250 undefined Source file /home/robak/Projects/ts-issue/packages/utils/tsconfig.json
FileWatcher:: Added:: WatchInfo: /home/robak/Projects/ts-issue/packages/app/tsconfig.json 2000 undefined Config file /home/robak/Projects/ts-issue/packages/app/tsconfig.json
DirectoryWatcher:: Added:: WatchInfo: /home/robak/Projects/ts-issue/packages/app 1 undefined Wild card directory /home/robak/Projects/ts-issue/packages/app/tsconfig.json
Elapsed:: 1ms DirectoryWatcher:: Added:: WatchInfo: /home/robak/Projects/ts-issue/packages/app 1 undefined Wild card directory /home/robak/Projects/ts-issue/packages/app/tsconfig.json
FileWatcher:: Added:: WatchInfo: /home/robak/Projects/ts-issue/packages/app/src/index.ts 250 undefined Source file /home/robak/Projects/ts-issue/packages/app/tsconfig.json
FileWatcher:: Added:: WatchInfo: /home/robak/Projects/ts-issue/packages/app/src/renameMe.ts 250 undefined Source file /home/robak/Projects/ts-issue/packages/app/tsconfig.json
FileWatcher:: Added:: WatchInfo: /home/robak/Projects/ts-issue/packages/tsconfig.json 2000 undefined Config file /home/robak/Projects/ts-issue/packages/tsconfig.json
FileWatcher:: Triggered with /home/robak/Projects/ts-issue/packages/app/src/renameMe.ts 2:: WatchInfo: /home/robak/Projects/ts-issue/packages/app/src/renameMe.ts 250 undefined Source file /home/robak/Projects/ts-issue/packages/app/tsconfig.json
Elapsed:: 0ms FileWatcher:: Triggered with /home/robak/Projects/ts-issue/packages/app/src/renameMe.ts 2:: WatchInfo: /home/robak/Projects/ts-issue/packages/app/src/renameMe.ts 250 undefined Source file /home/robak/Projects/ts-issue/packages/app/tsconfig.json
[11:15:39 AM] File change detected. Starting incremental compilation...

[11:15:39 AM] Failed to parse file 'packages/app/tsconfig.json': /home/robak/Projects/ts-issue/packages/app/src/renameMe.ts does not exist.

[11:15:39 AM] Building project '/home/robak/Projects/ts-issue/packages/app/tsconfig.json'...

error TS6053: File '/home/robak/Projects/ts-issue/packages/app/src/renameMe.ts' not found.

/home/robak/Projects/ts-issue/node_modules/typescript/lib/lib.d.ts
/home/robak/Projects/ts-issue/node_modules/typescript/lib/lib.es5.d.ts
/home/robak/Projects/ts-issue/node_modules/typescript/lib/lib.dom.d.ts
/home/robak/Projects/ts-issue/node_modules/typescript/lib/lib.webworker.importscripts.d.ts
/home/robak/Projects/ts-issue/node_modules/typescript/lib/lib.scripthost.d.ts
/home/robak/Projects/ts-issue/packages/utils/lib/index.d.ts
/home/robak/Projects/ts-issue/packages/app/src/index.ts
Files:                          7
Lines:                      24822
Nodes:                     111252
Identifiers:                40852
Symbols:                    24660
Types:                         76
Instantiations:                 0
Memory used:               46001K
Assignability cache size:       0
Identity cache size:            0
Subtype cache size:             0
Strict subtype cache size:      0
I/O Read time:              0.00s
Parse time:                 0.19s
ResolveTypeReference time:  0.00s
ResolveModule time:         0.01s
Program time:               0.20s
Bind time:                  0.11s
Total time:                 0.31s
[11:15:39 AM] Found 1 error. Watching for file changes.

sysLog:: onTimerToUpdateChildWatches:: 1
sysLog:: invokingWatchers:: 1ms:: 0
DirectoryWatcher:: Triggered with /home/robak/Projects/ts-issue/packages/app :: WatchInfo: /home/robak/Projects/ts-issue/packages/app 1 undefined Wild card directory /home/robak/Projects/ts-issue/packages/app/tsconfig.json
/home/robak/Projects/ts-issue/packages/app is output file
Elapsed:: 0ms DirectoryWatcher:: Triggered with /home/robak/Projects/ts-issue/packages/app :: WatchInfo: /home/robak/Projects/ts-issue/packages/app 1 undefined Wild card directory /home/robak/Projects/ts-issue/packages/app/tsconfig.json
sysLog:: Elapsed 1ms:: onTimerToUpdateChildWatches:: 0 undefined

@sheetalkamat
Copy link
Member

Well thank you for providing the log. This seems to be similar to #37994 and introduced by delayed child watcher updates (#35615)
Meanwhile you can work around this by passing --synchronousWatchDirectory

@sheetalkamat sheetalkamat added Bug A bug in TypeScript and removed Needs More Info The issue still hasn't been fully clarified labels May 21, 2020
@sheetalkamat sheetalkamat self-assigned this May 21, 2020
@sheetalkamat sheetalkamat added this to the TypeScript 4.0 milestone May 21, 2020
sheetalkamat added a commit that referenced this issue Jun 11, 2020
@sheetalkamat sheetalkamat added the Fix Available A PR has been opened for this issue label Jun 11, 2020
sheetalkamat added a commit that referenced this issue Jun 16, 2020
* If there is no changes to folder structure when watching directories recursively, send the updates to fileNames only
Fixes #37994

* Ignore excluded directories from wild card watching

* Testcase showing that renaming file with non sync directory watcher displays correct error in the end
Testcase for #38684
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Fix Available A PR has been opened for this issue
Projects
None yet
Development

No branches or pull requests

2 participants