Skip to content

chore: update typescript experience #10628

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

Merged
merged 4 commits into from
Jan 14, 2025
Merged

chore: update typescript experience #10628

merged 4 commits into from
Jan 14, 2025

Conversation

farfromrefug
Copy link
Collaborator

@farfromrefug farfromrefug commented Sep 24, 2024

now when using types.isString for example, typescript will understand that the arg is actually a string and propose intelisense afterward

PR Checklist

What is the current behavior?

What is the new behavior?

Fixes/Implements/Closes #[Issue Number].

now when using `types.isString` for example, typescript will understand that the arg is actually a string and propose intelisense afterward
NathanWalker
NathanWalker previously approved these changes Sep 24, 2024
rigor789
rigor789 previously approved these changes Sep 24, 2024
@farfromrefug farfromrefug dismissed stale reviews from rigor789 and NathanWalker via 10ff999 October 2, 2024 12:43
@NathanWalker NathanWalker added this to the 8.9 milestone Nov 19, 2024
@NathanWalker NathanWalker merged commit 17a94a2 into main Jan 14, 2025
3 checks passed
@NathanWalker NathanWalker deleted the farfromrefug-patch-1 branch January 14, 2025 02:39
Comment on lines +21 to 27
export function isObject(value: any): value is Record<string,any> {
if (!value) {
return false;
}

return typeof value === 'object';
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is an invalid type guard.

an array, date, regex, class would also result in true but is not of type Record<string, any>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@farfromrefug you should take a look at this

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@offizium-berndstorath indeed it would not work with Date/Regex ... However i dont think that s what that method was intended for seeing where it is used. In this case i think we should have a isDate, isRegex ...
I mean i dont see any place where isObject would be called with a Date, Regex, ...

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@farfromrefug you are correct. these are not really what im concerned about. its mostly about array

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants