Closed StringKe closed 11 months ago
If you export an arrow function, it will be handled by the SyntaxKind.VariableDeclaration. Are there any cases that cannot be handled by a VariableDeclaration?
It cannot be exported using this, which should be Identifier
.
import { Checkbox as $Checkbox } from '@mantine/core';
import { useController } from 'react-hook-form';
import type { CheckboxProps as $CheckboxProps } from '@mantine/core';
import type { FieldValues, UseControllerProps } from 'react-hook-form';
import { CheckboxGroup } from './CheckBoxGroup';
export type CheckboxProps<T extends FieldValues> = UseControllerProps<T> &
Omit<$CheckboxProps, 'checked' | 'defaultValue'>;
export const Checkbox = <T extends FieldValues>({
name,
control,
defaultValue,
rules,
shouldUnregister,
onChange,
...props
}: CheckboxProps<T>) => {
const {
field: { value, onChange: fieldOnChange, ...field },
fieldState,
} = useController<T>({
name,
control,
defaultValue,
rules,
shouldUnregister,
});
return (
<$Checkbox
error={fieldState.error?.message}
value={value}
checked={value}
onChange={(e) => {
fieldOnChange(e);
onChange?.(e);
}}
{...field}
{...props}
/>
);
};
Checkbox.Group = CheckboxGroup;
Checkbox.Item = $Checkbox;
The getIsIsolatedModules
function is used to determine whether or not the type
keyword can be applied to the export syntax. For example, a class cannot add the type keyword, but an interface can. Since identifiers are typically treated as variables, the type keyword cannot be applied to them. Therefore, the return value of SyntaxKind.Identifier
should be false, not true.
Attention: 1 lines
in your changes are missing coverage. Please review.
Comparison is base (
e40dd84
) 88.29% compared to head (ca5cc43
) 88.22%.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
support export identifier