Skip to content

Typescript - logLevel property on createInstance config is incorrect #614

Closed
@jrbarnard

Description

@jrbarnard

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions