Skip to content
This repository has been archived by the owner on Oct 18, 2024. It is now read-only.

Commit

Permalink
docs: 📚️ use jsdoc for global.d.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
ecxyzzy committed Dec 21, 2023
1 parent 3c1933a commit b8e59a5
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions apps/api/src/global.d.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
// These are the type declarations for the virtual modules
// used by the `/courses/{id}` and `/instructors/{id}` routes.
// The reason we have to use inline imports here is because with `import` statements, TypeScript
// treats this as a normal module rather than an ambient module, and so the module declarations
// don't actually work when consumed by other TypeScript source files.
/**
* Ambient declaration file for defining "virtual" modules/files.
* The file contents are generated dynamically during build time by esbuild.
* DO NOT add any imports/exports; that converts the file to a regular module
* and removes the global declarations.
*/

/**
* Virtual module for caching course information during build time.
*/
declare module "virtual:courses" {
declare const courses: Record<string, import("@peterportal-api/types").Course>;
}

/**
* Virtual module for caching instructor information during build time.
*/
declare module "virtual:instructors" {
declare const instructors: Record<string, import("@peterportal-api/types").Instructor>;
}

0 comments on commit b8e59a5

Please sign in to comment.