You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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.
The text was updated successfully, but these errors were encountered:
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:
javascript-sdk/packages/optimizely-sdk/lib/index.d.ts
Line 71 in e0158e5
javascript-sdk/packages/optimizely-sdk/lib/shared_types.ts
Line 99 in e0158e5
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.
The text was updated successfully, but these errors were encountered: