-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
Enable strictFunctionTypes #49929
Enable strictFunctionTypes #49929
Conversation
visitNode(node, visitor), | ||
/*visitor*/ undefined, | ||
visitNode(node, visitor, isInitializedVariable), | ||
visitor, |
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.
This was the one case where we had an undefined visitor but I wasn't sure what to do. Passing in the visitor here still passes all tests, so, I can't tell if this was intentional or just an oversight.
export function visitNode( | ||
node: Node, | ||
visitor: Visitor | undefined, | ||
test?: (node: Node) => boolean, |
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.
I tried making this change; there were a few cases where it wasn't clear what kind of thing was to be returned (sometimes it wasn't used at all, or were return visitNode(node, visitor)
), then the 3-4 cases where we use visitNode to do node cloning (and more about the inability to pass a non-type-predicate test downward).
I'm personally still of the opinion that it's worth allowing a fallback that's just Node
for cases where the return type doesn't matter or it isn't used. Maybe we could make that overload internal, but it does seem useful in general. Not sure how to evaluate that for existing codebases, though.
@typescript-bot test this |
Heya @jakebailey, I've started to run the diff-based user code test suite (tsserver) on this PR at 4ff34cb. You can monitor the build here. Update: The results are in! |
Heya @jakebailey, I've started to run the extended test suite on this PR at 4ff34cb. You can monitor the build here. |
Heya @jakebailey, I've started to run the diff-based user code test suite on this PR at 4ff34cb. You can monitor the build here. Update: The results are in! |
Heya @jakebailey, I've started to run the parallelized Definitely Typed test suite on this PR at 4ff34cb. You can monitor the build here. |
Heya @jakebailey, I've started to run the diff-based top-repos suite (tsserver) on this PR at 4ff34cb. You can monitor the build here. Update: The results are in! |
Heya @jakebailey, I've started to run the diff-based top-repos suite on this PR at 4ff34cb. You can monitor the build here. Update: The results are in! |
Heya @jakebailey, I've started to run the perf test suite on this PR at 4ff34cb. You can monitor the build here. Update: The results are in! |
@jakebailey Here are the results of running the user test suite comparing Everything looks good! |
1 similar comment
@jakebailey Here are the results of running the user test suite comparing Everything looks good! |
Heya @jakebailey, I've run the RWC suite on this PR - assuming you're on the TS core team, you can view the resulting diff here. |
@jakebailey Here they are:
CompilerComparison Report - main..49929
System
Hosts
Scenarios
TSServerComparison Report - main..49929
System
Hosts
Scenarios
StartupComparison Report - main..49929
System
Hosts
Scenarios
Developer Information: |
@jakebailey Here are the results of running the top-repos suite comparing Everything looks good! |
@jakebailey Here are the results of running the top-repos suite comparing Something interesting changed - please have a look. Detailsfelixrieseberg/windows95
|
@@ -4473,6 +4496,7 @@ declare namespace ts { | |||
} | |||
type FileWatcherCallback = (fileName: string, eventKind: FileWatcherEventKind, modifiedTime?: Date) => void; | |||
type DirectoryWatcherCallback = (fileName: string) => void; | |||
type BufferEncoding = "ascii" | "utf8" | "utf-8" | "utf16le" | "ucs2" | "ucs-2" | "base64" | "latin1" | "binary" | "hex"; |
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.
I wonder if we could even limit this to future-proof ourselves. But maybe we shouldn't break our heads over it.
Looked at those server traces; they all reproduce on main as well. |
@typescript-bot pack this |
Heya @jakebailey, I've started to run the tarball bundle task on this PR at 4ff34cb. You can monitor the build here. |
Hey @jakebailey, I've packed this into an installable tgz. You can install it for testing by referencing it in your
and then running There is also a playground for this build and an npm module you can use via |
TODO:
TIn
andTOut
in the new visitor API; this actually mirrors the problems I have withcast
in Sub-optimal type parameter inference with strictFunctionTypes enabled #52111, but to an even greater extent.visitor
should still be optional.createJSDocDeprecatedTag
.isParameter
.BufferEncoding
.VisitResult<Node | undefined>
orVisitResult<Node> | undefined
?private handlers = new Map(...)