43 sutotal: string;
44 billing_type: string;
45 plan_version_id: string;
46 metadata: any;47}
48
49export interface MarkInvoiceStatusAsPaid {
17 total_amount_due: number;
18 subscriptions: CustomerDetailSubscription[];
19 billing_address: string;
20 integrations: any ;21 invoices: InvoiceType[];
22 balance_adjustments: BalanceAdjustments[];
23}
28export interface Action {
29 id: number;
30 actor: ActionUserType;
31 verb: any;32 action_object: any;
33 target: any;
34 public: boolean;
29 id: number;
30 actor: ActionUserType;
31 verb: any;
32 action_object: any;33 target: any;
34 public: boolean;
35 description: string;
30 actor: ActionUserType;
31 verb: any;
32 action_object: any;
33 target: any;34 public: boolean;
35 description: string;
36 timestamp: string;
58 });
59 },
60
61 onError: (error: any) => { 62 toast.error("Error creating metric: " + error.response.data.detail, {
63 position: toast.POSITION.TOP_CENTER,
64 });
27const ExperimentResults: FC = () => {
28 const params = useParams();
29 const navigate = useNavigate();
30 const { experimentId } = params as any; 31 const [selectedSubstitution, setSelectedSubstitution] = React.useState<
32 SpecificResults | undefined
33 >();
264 .validateFields()
265 .then((values) => {
266 const usagecomponentslist: CreateComponent[] = [];
267 const components: any = Object.values(componentsData);268 if (components) {
269 for (let i = 0; i < components.length; i++) {
270 const usagecomponent: CreateComponent = {
182 setTargetCustomerFormVisible(false);
183 };
184
185 const handleComponentAdd = (newData: any) => {186 const old = componentsData;
187
188 if (editComponentItem) {
168 );
169 };
170
171 const onFinishFailed = (errorInfo: any) => {};172
173 const hideComponentModal = () => {
174 setcomponentVisible(false);
87 }, []);
88
89 useEffect(() => {
90 const initialComponents: any[] = plan.versions[versionIndex].components.map( 91 (component) => {
92 return {
93 metric: component.billable_metric.billable_metric_name,
59 const [componentsData, setComponentsData] = useState<any>([]);
60 const [form] = Form.useForm();
61 const { setReplacementPlan } = usePlanUpdater();
62 const [editComponentItem, setEditComponentsItem] = useState<any>(); 63 const [targetCustomerId, setTargetCustomerId] = useState<string>(); // target customer id
64 const [allPlans, setAllPlans] = useState<PlanType[]>([]);
65 const [availableBillingTypes, setAvailableBillingTypes] = useState<
56 const [activeVersion, setActiveVersion] = useState<boolean>(false);
57 const [activeVersionType, setActiveVersionType] = useState<string>();
58 const navigate = useNavigate();
59 const [componentsData, setComponentsData] = useState<any>([]); 60 const [form] = Form.useForm();
61 const { setReplacementPlan } = usePlanUpdater();
62 const [editComponentItem, setEditComponentsItem] = useState<any>();
58 instance.defaults.headers.common["Authorization"] = `Token ${token}`;
59 queryClient.invalidateQueries("session");
60 },
61 onError: (error: any) => { 62 toast.error(error.response.data.detail, {
63 position: "top-center",
64 });
178 .validateFields()
179 .then((values) => {
180 const usagecomponentslist: CreateComponent[] = [];
181 const components: any = Object.values(componentsData);182 if (components) {
183 for (let i = 0; i < components.length; i++) {
184 const usagecomponent: CreateComponent = {
147 setcomponentVisible(false);
148 };
149
150 const handleComponentEdit = (id: any) => {151 const currentComponent = componentsData.filter((item) => item.id === id)[0];
152
153 setEditComponentsItem(currentComponent);
123 setcomponentVisible(true);
124 };
125
126 const handleComponentAdd = (newData: any) => {127 const old = componentsData;
128
129 if (editComponentItem) {
113 );
114 };
115
116 const onFinishFailed = (errorInfo: any) => {};117
118 const hideComponentModal = () => {
119 setcomponentVisible(false);
23
24export type Actions = {
25 type: ActionTypes;
26 payload?: any;27};
28
29export type ActionCreators = {
27const AppRoutes: FC = () => {
28 const [collapse, setCollapse] = useState(false);
29
30 const handleToggle = (event: any) => {31 event.preventDefault();
32 collapse ? setCollapse(false) : setCollapse(true);
33 };
5
6type Props = {
7 level?: 1 | 2 | 3 | 4
8 children: any 9}
10export const Title = ({ level = 1, children }: Props) => {
11 return <Typography.Title level={level}>{children}</Typography.Title>
3type Props = {
4 color: "gold" | "default";
5};
6export const Paper = (props: Props | any) => { 7 return (
8 <div
9 {...props}
5
6type Props = {
7 level?: 1 | 2 | 3 | 4
8 children: any 9}
10export const Button = ({ level = 1, children }: Props) => {
11 return BTN
27 });
28 };
29
30 const menuItemsBasic: any = [ 31 {
32 key: "/dashboard",
33 icon: <DashboardOutlined />,
75 },
76 ];
77
78 const menuItemsAdmin: any = [ 79 {
80 key: "/dashboard",
81 icon: <DashboardOutlined />,
The any
type can sometimes leak into your codebase. TypeScript compiler skips the type checking of the any
typed variables, so it creates a potential safety hole, and source of bugs in your codebase. We recommend using unknown
or never
type variable.
In TypeScript, every type is assignable to any
. This makes any
a top type (also known as a universal supertype) of the type system.
The any
type is essentially an escape hatch from the type system. As developers, this gives us a ton of freedom: TypeScript lets us perform any operation we want on values of type any
without having to perform any checking beforehand.
The developers should not assign any
typed value to variables and properties, which can be hard to pick up on, especially from the external library; instead, developers can use the never
or unknown
type variable.
Bad Practice
const age: any = 'seventeen';
const ages: any[] = ['seventeen'];
const ages: Array<any> = ['seventeen'];
function greet(): any {}
function greet(): any[] {}
function greet(): Array<any> {}
function greet(): Array<Array<any>> {}
function greet(param: Array<any>): string {}
function greet(param: Array<any>): Array<any> {}
Recommended
const age: number = 17;
const ages: number[] = [17];
const ages: Array<number> = [17];
function greet(): string {}
function greet(): string[] {}
function greet(): Array<string> {}
function greet(): Array<Array<string>> {}
function greet(param: Array<string>): string {}
function greet(param: Array<string>): Array<string> {}