mozilla / nimbus-shared

Shared data and schemas for Project Nimbus
https://mozilla.github.io/nimbus-shared
Mozilla Public License 2.0
6 stars 15 forks source link

Add firefox channel to audiences fixes #60 #77

Closed jaredlockhart closed 4 years ago

jaredlockhart commented 4 years ago

We added 'release' as part of the targeting expression but for Experimenter to mark it on an experiment we need to put it in its own field, rather than trying to parse it out of the filter expression.

jaredlockhart commented 4 years ago

Oh good idea @mythmon !

I think that's how enums with string values would look, but I'm getting this and I'm not sure what to do with it:

src/_generated/typeGuardHelpers.ts:21:65 - error TS2677: A type predicate's type must be assignable to its parameter's type.
  Type 'FirefoxChannel' is not assignable to type 'object'.

21 export function targeting_isFirefoxChannel(obj: object): obj is FirefoxChannel { return isSchema("targeting/FirefoxChannel", obj); }
                                                                   ~~~~~~~~~~~~~~

src/_generated/typeGuardHelpers.ts:23:77 - error TS2677: A type predicate's type must be assignable to its parameter's type.
  Type 'FirefoxChannel' is not assignable to type 'object'.

23 export function targeting_assertFirefoxChannel(obj: object): asserts obj is FirefoxChannel { return assertSchema("targeting/FirefoxChannel", obj); }
                                                                               ~~~~~~~~~~~~~~

Found 2 errors.

make: *** [.timestamps/tsc-last-run] Error 2
mythmon commented 4 years ago

Oh. Yeah, that's the right way to types in enums, but we can't import types between schema files right now. I meant yous hould make it the stringly typed enum-like thing I put in my comment. That will still catch if you use the wrong strings, but it won't trip up the schema compiler.

jaredlockhart commented 4 years ago

@mythmon Yep that seems to work 👍