Skip to content

Typescript - logLevel property on createInstance config is incorrect #614

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

Closed
jrbarnard opened this issue Nov 9, 2020 · 2 comments
Closed

Comments

@jrbarnard
Copy link

jrbarnard commented Nov 9, 2020

What I wanted to do

Use createInstance in typescript

What I expected to happen

For the types to support LogLevel | string

What actually happened

The createInstance Config logLevel property type is incorrect. It type hints just the LogLevel enum, but it also supports a string representation of the log level which will be coerced at runtime.

Reference to types that need changing:

Steps to reproduce

Set up a typescript project with the optimizely sdk and attempt to use createInstance with a string logLevel.
If you cast it and run the code it will work as expect. But the type does not support the string logLevel if not casted.

@mjc1283
Copy link
Contributor

mjc1283 commented Nov 10, 2020

Thanks @jrbarnard. Agree with your assessment - will fix this.

@yavorona
Copy link
Contributor

@jrbarnard Thanks again for reporting this issue. We merged #627 fix and released it in v4.4.2

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

No branches or pull requests

3 participants