Summary
Hello I noticed that the examples on the debugging page (https://react.dev/reference/react-compiler/logger#basic-logging) for the compiler don’t include TypeScript types. It might be helpful to add them for the basic example like so
import type { Logger } from 'babel-plugin-react-compiler';
{
...
logger: {
logEvent(filename, event) {
switch (event.kind) {
case 'CompileSuccess': {
console.log(`✅ Compiled: ${filename}`);
break;
}
case 'CompileError': {
console.log(`❌ Skipped: ${filename}`);
break;
}
default: {}
}
}
} satisfies Logger,
...
}
Using satisfies Logger ensures that logEvent(filename, event) is properly typed without needing to manually annotate the parameters.
Cheers
Page
Compiler debugging docs
Details
Adding types would be helpful for IntelliSense and would also help avoid potential errors.
Summary
Hello I noticed that the examples on the debugging page (https://react.dev/reference/react-compiler/logger#basic-logging) for the compiler don’t include TypeScript types. It might be helpful to add them for the basic example like so
Using
satisfies Loggerensures thatlogEvent(filename, event)is properly typed without needing to manually annotate the parameters.Cheers
Page
Compiler debugging docs
Details
Adding types would be helpful for IntelliSense and would also help avoid potential errors.