Skip to content

Commit

Permalink
feat(Company): add code
Browse files Browse the repository at this point in the history
  • Loading branch information
wmakeev committed Jul 26, 2021
1 parent d022e36 commit 9b47ba7
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "moysklad-api-model",
"version": "0.3.8",
"version": "0.3.9",
"description": "Объектная модель API МойСклад для TypeScript проектов",
"main": "build/src/index.js",
"types": "build/src/index.d.ts",
Expand Down
8 changes: 3 additions & 5 deletions src/model/Company.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
import type { Address } from './Address'
import type { Agent } from './Agent'
import type { CollectionRef } from './CollectionRef'
import type { EntityRef } from './EntityRef'
import type { MetaType } from './MetaType'
import type { Address, Agent, CollectionRef, EntityRef } from '.'

export type CompanyMetaType = 'counterparty' | 'organization'

Expand All @@ -21,6 +17,8 @@ export interface CompanyDiscountData {
}

export interface Company<T extends CompanyMetaType> extends Agent<T> {
code: string

/** Тип Контрагента */
companyType:
| CompanyType.Individual
Expand Down
3 changes: 3 additions & 0 deletions test/model/Contract.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,6 @@ if (t20.contractType === 'Commission') {
t20.rewardPercent = 50
}
}

const t30 = {} as Contract & { contractType: 'Commission' }
t30.rewardType
1 change: 1 addition & 0 deletions test/model/utils/Expand.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ const t50 = {} as Expand<CustomerOrder, 'agent.group,state'>
t50.owner.meta

t50.agent.name // expand
t50.agent.code

// @ts-expect-error
t50.project?.id
Expand Down

0 comments on commit 9b47ba7

Please sign in to comment.