-
Notifications
You must be signed in to change notification settings - Fork 25.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
[4.x] fix(core): stringify shouldn't throw when toString returns null/undefined #14975
Conversation
11f1086
to
af553d7
Compare
packages/core/test/util_spec.ts
Outdated
class Foo { | ||
toString(): string { return undefined; } | ||
} | ||
expect(stringify(new Foo())).toBe('undefined'); |
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.
expect(stringify({toString => undefined})).toBe('undefined');
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.
nit: could simplify the test
af553d7
to
8336f6c
Compare
@vicb done. simplified the tests + rebase |
packages/core/test/util_spec.ts
Outdated
export function main() { | ||
describe('stringify', () => { | ||
it('should return string undefined when toString returns undefined', | ||
() => expect(stringify({toString: (): string => undefined})).toBe('undefined')); |
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.
string -> any
@DzmitryShylovich thanks ! Could you please update the return type |
8336f6c
to
cea22c9
Compare
@vicb done |
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. |
Fixes #14948