Created type definitions for composer-concerto package (#36949)

* composer-concerto new package

* composer-concerto tests file

* composer-concerto fix tests

* composer-concerto tslint.json

* revision changes

* toString declarations

* removed tslint rules

* alignment
This commit is contained in:
j4m3sb0mb
2019-07-18 08:53:22 -07:00
committed by Andrew Branch
parent b746320a23
commit c27453f958
4 changed files with 1182 additions and 0 deletions
@@ -0,0 +1,28 @@
import { ModelManager, Factory, Serializer } from 'composer-concerto';
const modelManager = new ModelManager();
modelManager.addModelFile(
`namespace org.acme.address
/**
* This is a concept
*/
concept PostalAddress {
o String streetAddress optional
o String postalCode optional
o String postOfficeBoxNumber optional
o String addressRegion optional
o String addressLocality optional
o String addressCountry optional
}`,
'filename.cto'
);
const factory = new Factory(modelManager);
const postalAddress = factory.newConcept('org.acme.address', 'PostalAddress');
postalAddress.streetAddress = '1 Maine Street';
const serializer = new Serializer(factory, modelManager);
const plainJsObject = serializer.toJSON(postalAddress);
const sPostalAddress = serializer.fromJSON(plainJsObject);
const streetAddress: string = sPostalAddress.streetAddress;
+1128
View File
File diff suppressed because it is too large Load Diff
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"composer-concerto-tests.ts"
]
}
+3
View File
@@ -0,0 +1,3 @@
{
"extends": "dtslint/dt.json"
}