diff --git a/docs/_pages/grammar.md b/docs/_pages/grammar.md index 5903c6ee..20dce193 100644 --- a/docs/_pages/grammar.md +++ b/docs/_pages/grammar.md @@ -68,15 +68,19 @@ SimpleType = SingletonType = STRING | 'true' | 'false' -UnionSuffix = {'?'} ['|' SimpleType] -IntersectionSuffix = ['&' SimpleType] -Type = SimpleType {UnionSuffix} | SimpleType {IntersectionSuffix} +UnionSuffix = {'?'} {'|' SimpleType {'?'}} +IntersectionSuffix = {'&' SimpleType} +Type = SimpleType (UnionSuffix | IntersectionSuffix) GenericTypePackParameter = NAME '...' GenericTypeList = NAME [',' GenericTypeList] | GenericTypePackParameter {',' GenericTypePackParameter} -GenericTypePackParameterWithDefault = NAME '...' ['=' (TypePack | VariadicTypePack | GenericTypePack)] -GenericTypeListWithDefaults = NAME ['=' Type] [',' GenericTypeListWithDefaults] | GenericTypePackParameterWithDefault {',' GenericTypePackParameterWithDefault} +GenericTypePackParameterWithDefault = NAME '...' '=' (TypePack | VariadicTypePack | GenericTypePack) +GenericTypeListWithDefaults = + GenericTypeList | + NAME {',' NAME} {',' NAME '=' Type} {',' GenericTypePackParameterWithDefault} | + NAME '=' Type {',' GenericTypePackParameterWithDefault} | + GenericTypePackParameterWithDefault {',' GenericTypePackParameterWithDefault} TypeList = Type [',' TypeList] | '...' Type TypeParams = (Type | TypePack | VariadicTypePack | GenericTypePack) [',' TypeParams]