question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add `isEqualType` method?

See original GitHub issue

To ensure a type is correct. Can be useful for testing.

We could use this type for it: https://github.com/sindresorhus/type-fest/blob/98158e0fcb354e36c8aaf4b6808ca1498156f1f4/source/internal.d.ts#L1-L11

Example:

// Type
isEqualType<ExpectedType, ActualType>();

// Value
isEqualType(expectedValue, actualValue);

// Mixed
isEqualType<ExpectedType>()(value);

Thoughts?

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:3
  • Comments:9 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
ritikbhedacommented, Oct 29, 2021

Hello there @sindresorhus and @bradgarropy, I would try to work on this enhancement. I am clear about Type and Value but I really did not understand the Mixed functions you mentioned above. If you could please give more information on that function, that would be great help!

1reaction
sindresorhuscommented, Jan 5, 2022

@younho9 I don’t see why it would. It’s about comparing type, not structure.

Read more comments on GitHub >

github_iconTop Results From Across the Web

isEqualTypeAny - Bohemia Interactive Community Wiki
Description: Compares type of given value to every type in the given array and if match is found, true is returned. Groups: Variables....
Read more >
Return variables to class format - ARMA 3
Hi. I have this dilemma where I am getting some values off from a class and then I need to return those values...
Read more >
IsEqual Methods - RTMath
The IsEqual type exposes the following members. Methods. Name, Description. Public method, Add(Double, Double). Add value to ...
Read more >
TestElementProperty (Apache JMeter dist API)
Method. Description. void. addProperty(JMeterProperty prop). Add a property to the ... Methods inherited from class org.apache.jmeter.testelement.property.
Read more >
Type - Hitachi Vantara Lumada and Pentaho Documentation
IsEqual. Type ... Adds, overrides or configures properties of this complex type. ... This method does not add the special id and base...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found