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

Investigate undocumented readDirectory change #45990

Closed
DanielRosenwasser opened this issue Sep 21, 2021 · 2 comments · Fixed by #46086
Closed

Investigate undocumented readDirectory change #45990

DanielRosenwasser opened this issue Sep 21, 2021 · 2 comments · Fixed by #46086
Assignees
Labels
Bug A bug in TypeScript Fix Available A PR has been opened for this issue

Comments

@DanielRosenwasser
Copy link
Member

DanielRosenwasser commented Sep 21, 2021

@amcasey Hi! I don't know if it the right place to ask a question but I found this thread relative to the problem (I'm sorry if it's not). Should directoryExists be called with an absolute path like directoryExists(combinePaths(currentDirectory, basePath))?

I came across the undocumented breaking change in 4.4-beta that causes (for example) ts.sys.readDirectory("", [".ts",".tsx",".d.ts"],["node_modules","dist"],["**/*"]) to return an empty array. Before 4.4-beta it has been returning the correct array of files. So I wonder if it is a bug or desired behaviour.

Thank you in advance.

Originally posted by @gretzkiy in #44710 (comment)

@DanielRosenwasser DanielRosenwasser changed the title Investigate undocumented readDirectory Change Investigate undocumented readDirectory change Sep 21, 2021
@DanielRosenwasser
Copy link
Member Author

DanielRosenwasser commented Sep 21, 2021

Looks like there's a clear mistake where every function in getFileMatcherPatterns should take absolutePath, but getBasePaths doesn't.

-            basePaths: getBasePaths(path, includes, useCaseSensitiveFileNames)
+            basePaths: getBasePaths(absolutePath, includes, useCaseSensitiveFileNames)

But unclear if that's related.

@DanielRosenwasser DanielRosenwasser added the Bug A bug in TypeScript label Sep 21, 2021
@DanielRosenwasser DanielRosenwasser added this to the TypeScript 4.5.0 milestone Sep 21, 2021
@typescript-bot typescript-bot added the Fix Available A PR has been opened for this issue label Sep 27, 2021
@amcasey
Copy link
Member

amcasey commented Sep 27, 2021

@DanielRosenwasser I'm probably missing something obvious, but why is the getBasePaths call a mistake?

Edit: The claim that it should use the absolute path is very plausible, but getBasePaths has a bunch of logic that suggests that it was expecting to handle relative paths.

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

Successfully merging a pull request may close this issue.

3 participants