Flagsmith / flagsmith-js-client

Javascript Client for Flagsmith. Ship features with confidence using feature flags and remote config. Host yourself or use our hosted version at https://www.flagsmith.com/

Home Page:https://www.flagsmith.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

defaultFlags: Property 'id' is missing in type '{ enabled: true; }' but required in type 'IFlagsmithFeature'.ts

franciscohanna92 opened this issue · comments

I'm trying to provide default values for my feature flags (following the docs) but I have a Typescript error:

Property 'id' is missing in type '{ enabled: true; }' but required in type 'IFlagsmithFeature'.ts(2741)

The error is present both in the method flagsmith.init and in the options.defaultFlags props for the FlagsmithProvider in the React SDK. I'm using flagsmith 3.13.0

image

As a workaround I'm just setting random number IDs for each flag, but I'm not sure if this has some unexpected consequences.

I guess a solution would be to have the id property as optional in the IFlagsmithFeature interface. Would you accept a PR for this?

Hi @franciscohanna92, yes, we'd love to accept a PR for this if you're happy to submit one.

Reviewing this, it does look like id is still needed under the hood - so yeah happy to accept this as being optional. Thanks!

id is now optional in 3.13.1 - thank you very much for raising

@kyle-ssg Thanks a lot!