Flow: proper type for regex

Created on 19 Jul 2016  Â·  3Comments  Â·  Source: facebook/flow

Couldn't find a builtin type for regular expression。Should I just use object for that?

question

Most helpful comment

Reg exps are just objects of class RegExp

All 3 comments

Reg exps are just objects of class RegExp

Resolved?

yeah, resolved, type TheExpression = RegExp works

@avikchaudhuri Have you more powerful idea?
Like type ActionType = $/^[A-Z_]+$/; ? :slightly_smiling_face:

RegExp type is type of variable, but $/^[A-Z_]+$/ can be subtype of string type — shifting powerty of flow to new dimension

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tp picture tp  Â·  3Comments

damncabbage picture damncabbage  Â·  3Comments

jamiebuilds picture jamiebuilds  Â·  3Comments

mjj2000 picture mjj2000  Â·  3Comments

ghost picture ghost  Â·  3Comments