-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Open
Labels
Description
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
Details
Adding types would be helpful for IntelliSense and would also help avoid potential errors.