18const formatNs = nsFormatter(['common', 'phone-type'])
19
20export const PhoneNumbers = ({ edit, ...props }: PhoneNumbersProps) =>
21 edit ? <PhoneNumbersEdit {...props} /> : <PhoneNumbersDisplay {...props} /> 22
23const PhoneNumbersDisplay = ({ parentId = '', passedData, direct, locationOnly }: PhoneNumbersProps) => {
24 const output: ReactElement[] = []
18const formatNs = nsFormatter(['common', 'phone-type'])
19
20export const PhoneNumbers = ({ edit, ...props }: PhoneNumbersProps) =>
21 edit ? <PhoneNumbersEdit {...props} /> : <PhoneNumbersDisplay {...props} /> 22
23const PhoneNumbersDisplay = ({ parentId = '', passedData, direct, locationOnly }: PhoneNumbersProps) => {
24 const output: ReactElement[] = []
19const anyTrue = (...args: boolean[]) => args.some((x) => x)
20
21export const Websites = ({ edit, ...props }: WebsitesProps) =>
22 edit ? <WebsitesEdit {...props} /> : <WebsitesDisplay {...props} /> 23
24const WebsitesDisplay = ({
25 parentId = '',
19const anyTrue = (...args: boolean[]) => args.some((x) => x)
20
21export const Websites = ({ edit, ...props }: WebsitesProps) =>
22 edit ? <WebsitesEdit {...props} /> : <WebsitesDisplay {...props} /> 23
24const WebsitesDisplay = ({
25 parentId = '',
22const anyTrue = (...args: boolean[]) => args.some((x) => x)
23
24export const Emails = ({ edit, ...props }: EmailsProps) =>
25 edit ? <EmailsEdit {...props} /> : <EmailsDisplay {...props} /> 26
27const EmailsDisplay = ({
28 parentId = '',
Variables, functions and types should always be used after they've been defined. This issue will flag any code snippets that use variables or types before definition.
Sometimes, the code will run just fine even when the variable is declared after use. Consider the following example:
const ram: Resource = { type: "memory", limit: 1024 ** 3 }
type Resource = {
type: string;
limit: number;
}
Here, Resource
is used in the annotation before it has been defined.
Similarly, it is possible to hoist function declarations and variables declared with the var
keyword:
const four = twice(2);
function twice(n: number) {
return n * 2;
}
However, it makes the code harder to follow when variables or types are declared after being used.
const knight: Radiant = {
order: "SurgeBinder"
strength: 30
}
interface Radiant {
order: string;
strength: number;
}
interface Radiant {
order: string;
strength: number;
}
const knight: Radiant = {
order: "SurgeBinder"
strength: 30
}