Escola LMS (Wellms) TypeScript Definitions
npm | typedoc page
Automatic transformation of Eloquent Models and Request rules to TypeScript Definition
This package transforms all Eloquent Models defined in
to Typescript definitions
Installing
- install dependencies
npm i @escolalms/ts-models
or yarn add @escolalms/ts-models
- import in main
index.d.ts
(if you have one)
import "@escolalms/ts-models";
- add this to
tsconfig
in include section
"include": ["node_modules/@escolalms/ts-models"]
The above is declaring namespaces, example ns EscolaLms.StationaryEvents.Models.StationaryEvent
that are take from PHP namespace.
Below is example
export async function stationaryEvents(
params: API.PaginationParams & {
name?: string;
},
options?: Record<string, any>
) {
return request<
API.DefaultMetaResponse<EscolaLms.StationaryEvents.Models.StationaryEvent>
>(`/api/admin/stationary-events`, {
method: "GET",
params: {
...params,
},
...(options || {}),
});
}
Adding new packages
- Add new package to composer.json
- Set proper namespace and package path in the config typescript.php
Releasing new version to npm
- Run generate action on main branch by pressing
re-run all jobs
- Wait until it's finished, new models.d.ts should be pushed automatically to the repository
- Once new models.d.ts You create new release rest should be handled by the script
- Release version on GH is the same as on npm (done automatically)