Skip to content
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

Tweaking types and removing any usage #172

Merged
merged 1 commit into from
Aug 7, 2023

Conversation

ghost
Copy link

@ghost ghost commented Aug 4, 2023

This PR removes the usage of any in typescript type definitions, which would otherwise defeat the purpose of using these types. Function overloading is used to derive the output type from the input options. If no options are given the return type is string, if options are defined the output-attribute will derive the output type (array, string, object or exponent).

Be warned: these types will work as long as the public API of the project stands, but are still better than any.

@avoidwork avoidwork merged commit f84d8ee into avoidwork:master Aug 7, 2023
@avoidwork
Copy link
Owner

This is 10.0.9.

standard?: 'iec' | 'jedec';
output?: 'array' | 'exponent' | 'object' | 'string';
Copy link
Owner

Choose a reason for hiding this comment

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

This is very important to not change the behaviour of.

Copy link
Author

Choose a reason for hiding this comment

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

You are correct. This was also not changed, but rather I overlooked the case that if other options are given and NOT output it also should return string and not force the setting of output. I will wait on the issue opener to create a PR, otherwise I can if wanted.

@avoidwork
Copy link
Owner

This was reverted for 10.0.10, due to what I'd call a too-strict interface; everything is optional.

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.

1 participant