-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
Add --types #952
Add --types #952
Conversation
@kitsonk @dsherret Any idea about this Windows-only error?
|
@dsherret Thanks for looking into it! How tied are we going to be to TS 3.0.3 ? Are you planning on upgrading to 3.1 soon? Is that difficult? |
@ry update to 16.0.4 and it should be fixed. Basically, it was removing the jsdoc when removing the declare modifier (the node position in the ast ignores jsdocs and comments). The work for being untied to 3.0.3 will be in version 17 and the work for that is basically done. I have tests that run through every supported compiler version to ensure there are no problems. I'm just adding a few small things to v17, but I should have a release ready for the weekend. I'll do a PR here when that's done. |
Adds //tools/ts_library_builder for building a unified .d.ts file for the deno runtime called lib.deno_runtime.d.ts This serves as a low-level documentation system for Deno.
@dsherret Thanks for looking into it ! |
@dsherret That definitely fixed one error - but it seems others have popped up. Any idea why this is open happening on Windows? |
@ry ok, that's very strange. I'll have to take a look tonight (if you get a chance, could you post the error you're getting here? It may take me a little time to setup the dependencies to build deno on windows and I could look into the error while everything is installing). No, I'm not sure. Any errors like that previous one should happen on both linux and windows. I'll look into it though. The compiler api shouldn't be parsing files differently based on the platform so perhaps there's some other external reason. Sorry once again! I have lots of tests and any errors we encounter here will be added to the test suite to ensure they don't happen in the future. |
@ry ok, I think it's because of these lines: const jsPath = join(basePath, "js");
const inputProjectFiles = inputProject
.getSourceFiles()
.map(sourceFile => sourceFile.getFilePath())
.filter(filePath => !filePath.startsWith(jsPath));
loadFiles(declarationProject, inputProjectFiles); The TypeScript compiler uses forwards slashes for everything regardless of platform (see here and the |
VariableStatement, | ||
VariableDeclarationKind | ||
} from "ts-simple-ast"; | ||
import * as ts from "typescript"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kitsonk sorry, didn't take a look at this until now. I recommend using the ts
named export from "ts-simple-ast" instead. That way you ensure the code always uses the typescript dependency that ts-simple-ast is relying on (just in case they ever happen to be different).
@ry I will work on unit tests today. 👍 |
Awesome - thanks! I will close this PR then since it's not ready to land. |
const inputProjectFiles = inputProject | ||
.getSourceFiles() | ||
.map(sourceFile => sourceFile.getFilePath()) | ||
.filter(filePath => !filePath.startsWith(jsPath)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kitsonk Was just thinking about this. I think this would work?
const jsDir = inputProject.getDirectoryOrThrow(join(basePath, "js"));
const inputProjectFiles = jsDir.getDescendantSourceFiles();
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, whoops! It's the opposite of that. Try this:
const jsDir = inputProject.getDirectoryOrThrow(join(basePath, "js"));
const inputProjectFiles = inputProject
.getSourceFiles()
.filter(sourceFile => !jsDir.isAncestorOf(sourceFile));
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What I did in the end for now was just create a normalizePath()
that replicates the TypeScript functionality (before I really took a look at this comment)... It looks like it is finally passing CI.
Continuation of #729 - this patch has my approval.
Due to the size and complexity of this, I want to do another round of reviews with @piscisaureus
The output of
./out/debug/deno --types
looks like this: https://gist.github.com/ry/906d9aa89e0fa6a4b17a21276d5158c5Fixes #632