estree / estree

The ESTree Spec
Other
5.05k stars 356 forks source link

extend interface & `<:` #274

Closed xp44mm closed 2 years ago

xp44mm commented 2 years ago

Can't understand what extend interface and <: mean, can anybody explain it?

the extend interface

extend interface Function {
    generator: boolean;
}

and <:

interface ForOfStatement <: ForInStatement {
    type: "ForOfStatement";
}
bradzacher commented 2 years ago

extend interface means that you take the original Function interface from an older version of the spec, and you augment it with the changes listed.

In your example it's saying that "the AST for this ES version adds the property generator: boolean to the Function AST node".


X <: Y means that X inherits from Y, and it lists the changes / additions.

In your example it's saying that the FoOfStatement AST node inherits its properties from the ForInStatement AST node, except the type property's value should be 'ForOfStatement' (instead of 'ForInStatement')

nzakas commented 2 years ago

Nice description 👍