Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2.8k
Closed
Description
Before You File a Documentation Request Please Confirm You Have Done The Following...
- I have looked for existingopen or closed documentation requests that match my proposal.
- I haveread the FAQ and my problem is not listed.
Suggested Changes
Coming over from@sosukesuzuki'shttps://discord.com/channels/1026804805894672454/1088474511759917106/1189257356899520512:
- When does the generator field become true? (
)typescript-eslint/packages/ast-spec/src/expression/ArrowFunctionExpression/spec.ts
Line 11 in7246e56
generator:boolean; - Why does the id field that is always null exist? (
Response from@Josh-Cena:
- Never:https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/typescript-estree/src/convert.ts#L1553
So, your two questions are actually one: why do we have useless fields on ArrowFunctionExpression?
I believe the only reason is because rules often use ArrowFunctionExpression,FunctionDeclaration,FunctionExpression as a selector, and you don't want to prevent people from querying if (func.generator)
But maybe others who are more familiar with the AST spec can say more
That's my understanding too.
Separately from#2726, let's add JSDoc comments in code? +1 that it's unclear.
Affected URL(s)
n/a (code comments)