Skip to content
On this page

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

  1. install dependencies npm i @escolalms/ts-models or yarn add @escolalms/ts-models
  2. import in main index.d.ts (if you have one)
js
import "@escolalms/ts-models";
  1. add this to tsconfig in include section
json
"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

ts
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

  1. Add new package to composer.json
  2. Set proper namespace and package path in the config typescript.php

Releasing new version to npm

  1. Run generate action on main branch by pressing re-run all jobs
  2. Wait until it's finished, new models.d.ts should be pushed automatically to the repository
  3. Once new models.d.ts You create new release rest should be handled by the script
  4. Release version on GH is the same as on npm (done automatically)