fix: move invoice type into explicit property
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { business, finance } from '../index.js';
|
||||
import type { TCurrency } from './currency.js';
|
||||
import { business, finance } from "../index.js";
|
||||
import type { TCurrency } from "./currency.js";
|
||||
|
||||
export type TInvoiceStatus = 'draft' | 'invoice' | 'paid' | 'refunded';
|
||||
export type TInvoiceStatus = "draft" | "invoice" | "paid" | "refunded";
|
||||
|
||||
export type TInvoiceItem = {
|
||||
position: number;
|
||||
@@ -11,14 +11,17 @@ export type TInvoiceItem = {
|
||||
unitQuantity: number;
|
||||
unitNetPrice: number;
|
||||
vatPercentage: number;
|
||||
}
|
||||
};
|
||||
|
||||
export type TInvoiceEnvelope<TYPE extends 'creditnote' | 'debitnote', FIELDS> = business.TLetterEnvelope<
|
||||
'invoice',
|
||||
export type TInvoiceEnvelope<
|
||||
TYPE extends "creditnote" | "debitnote",
|
||||
FIELDS
|
||||
> = business.TLetterEnvelope<
|
||||
"invoice",
|
||||
{
|
||||
invoiceId: string;
|
||||
invoiceType: TYPE;
|
||||
status: TInvoiceStatus;
|
||||
type: TYPE;
|
||||
items: TInvoiceItem[];
|
||||
periodOfPerformance?: {
|
||||
from: number;
|
||||
@@ -53,8 +56,8 @@ export type TInvoiceEnvelope<TYPE extends 'creditnote' | 'debitnote', FIELDS> =
|
||||
} & FIELDS
|
||||
>;
|
||||
|
||||
export type TCreditNote = TInvoiceEnvelope<'creditnote', {}>;
|
||||
export type TDebitNote = TInvoiceEnvelope<'debitnote', {}>;
|
||||
export type TCreditNote = TInvoiceEnvelope<"creditnote", {}>;
|
||||
export type TDebitNote = TInvoiceEnvelope<"debitnote", {}>;
|
||||
|
||||
export type TInvoice = TCreditNote | TDebitNote;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user