@flowio/api-types
v0.0.267
Published
Global TypeScript typings for Flow Commerce API
Keywords
Readme
@flowio/api-types
TypeScript typings for Flow Commerce API
Installation
npm install --save-dev @flowio/api-typesUsage
The following is a minimal tsconfig.json for use alongside this package:
tsconfig.json
{
"compilerOptions": {
"target": "ES2020",
"module": "CommonJS",
"lib": ["ES2020"],
"types": [
"@flowio/api-types"
]
}
}Note that specifying the "types" property overrides the default behaviour
of importing all global types under typeRoots. As a result, you may need
to specify global types you need in your project.
Types bundling
@flowio/api-types contains all of Flow's internal model information. There are times when we need
to publish some of this type information if the modelled data is used in a particular public
library.
You can use the npm binary flowio-bundle-api-types provided in this module to do that as
part of your project. This will inspect your supplied types output folder for flow types and
generate a 'bundle' named flowio-bundled-api-types.d.ts in your build types directory, and also
replace all references in your types accordingly from @flowio/api-types to the new bundle. This
will mean we are only publishing the types we need to for the public lib.
In order to use this functionality add the following script to your library's package.json.
{
"postbuild": "flowio-bundle-api-types --typesDir ./lib/types --packageName $npm_package_name --packageVersion $npm_package_version",
}⚠️ Note
Because the
flowio-bundle-api-typesscript modifies the output of the type declarations, it is important that in yourtsccommand to build the declarations you DO NOT use the--incrementaloption.
