mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 12:21:58 +00:00
25 lines
353 B
TypeScript
25 lines
353 B
TypeScript
// Correct
|
|
function *generatorGood(): Generator<number> {}
|
|
|
|
class GeneratorClassGood {
|
|
*method(): Generator<number> {
|
|
yield 50;
|
|
return 42;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// Need to explicit return type for async functions
|
|
// Incorrect
|
|
function *generatorBad() {
|
|
yield 50;
|
|
return 42;
|
|
}
|
|
|
|
class GeneratorClassBad {
|
|
*method() {
|
|
yield 50;
|
|
return 42;
|
|
}
|
|
}
|