-
Notifications
You must be signed in to change notification settings - Fork 24.7k
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
ts-api-guardian: overloading a function doesn't generate all of the signatures #22569
ts-api-guardian: overloading a function doesn't generate all of the signatures #22569
Conversation
let children: ts.Node[] = []; | ||
if (ts.isFunctionDeclaration(node)) { | ||
const symbol = this.typeChecker.getSymbolAtLocation(node.name); | ||
symbol.declarations.forEach(x => children.push(...x.getChildren())); |
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.
Concat is faster than push/spread if you care: dec => children = children.concat(dec.getChildren())
hey @alexeagle, I am having a bit of a problem here when I am doing changes in the serializer. Basicilly Bazel fails when golden files are not updated Gulp fails when golden files are updated So, it's impossible to have a green CI. |
@alan-agius4 that's a good point. In this case, can we just exclude core and common from the check that relies on the npm package? If not, I'll finish converting us over to the locally built one. |
Yes, absolutely, I pushed a change |
tools/gulp-tasks/public-api.js
Outdated
@@ -34,7 +36,8 @@ const entrypoints = [ | |||
'dist/packages-dist/platform-server/platform-server.d.ts', | |||
'dist/packages-dist/platform-server/testing.d.ts', | |||
'dist/packages-dist/router/router.d.ts', | |||
'dist/packages-dist/router/testing.d.ts', | |||
// The below has been excluded until we use the local build of API guardian | |||
//'dist/packages-dist/router/testing.d.ts', |
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.
We don't build an ng_package
for router, so this isn't safe to remove...
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.
removed.
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 think this means we need to do it now, or else you'll have a test failure on one side or the other due to the router change in this PR?
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.
Yes indeed we so need to migrate to locally built guardian now, as E2E will fail like this.
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 actually have an idea of what we can do at least until everything is migrated. (Not sure how much time that involves)
My idea is that when we call gulp public-api:enforce
we can a pre-gulp task invoking
bazel run //:install
bazel build //tools/ts-api-guardian:lib
And than from the gulp tasks, rather than requiring the node_module we require the local guardian.
@@ -215,7 +215,14 @@ class ResolvedDeclarationEmitter { | |||
} | |||
} | |||
|
|||
let children = node.getChildren(); | |||
let children: ts.Node[] = []; | |||
if (ts.isFunctionDeclaration(node)) { |
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.
Used ts.isFunctionDeclaration
instead of node.kind
because this is a type guard.
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'd put this kind of thing as a comment in the source code - many people will read that later, no one will see this thread
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.
done
let's land #22628 first to clean this up. I think you need router to be tested with the local ts-api-guardian. |
okay that's @alan-agius4 that's merged, can you re-base and green this up? thanks!! |
Hi @alan-agius4! This PR has merge conflicts due to recent upstream merges. |
Yes sure, give me a couple of hrs and I am on it!
…On Wed, 07 Mar 2018 at 19:58, Alex Eagle ***@***.***> wrote:
okay that's @alan-agius4 <https://github.com/alan-agius4> that's merged,
can you re-base and green this up? thanks!!
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#22569 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AQv-Wqzz9SW7I5Upuc0nxAm65Le_02KSks5tcC3agaJpZM4Sa4tL>
.
|
@alexeagle it’s green 🎉 |
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.
Awesome thank you!!
@@ -215,7 +215,14 @@ class ResolvedDeclarationEmitter { | |||
} | |||
} | |||
|
|||
let children = node.getChildren(); | |||
let children: ts.Node[] = []; | |||
if (ts.isFunctionDeclaration(node)) { |
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'd put this kind of thing as a comment in the source code - many people will read that later, no one will see this thread
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.
Thank you so much for this fix!
Welcome, glad to help. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Overloaded pure functions are not generated.
Issue Number: angular/ts-api-guardian#22
What is the new behavior?
Overloaded methods are generated
Does this PR introduce a breaking change?
Other information
Deltas
/cc @ocombe