Skip to content

Commit

Permalink
Add JSDoc typeof support via JSDoc plugin (#5882)
Browse files Browse the repository at this point in the history
* Preparation

* animation examples: remove ts-ignore

* fix rest
  • Loading branch information
kungfooman authored Dec 6, 2023
1 parent a86bd8b commit 201cbc0
Show file tree
Hide file tree
Showing 98 changed files with 30 additions and 410 deletions.
7 changes: 4 additions & 3 deletions conf-api.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"plugins": [
"plugins/markdown",
"./node_modules/jsdoc-tsimport-plugin/index.js"
"./node_modules/jsdoc-tsimport-plugin/index.js",
"./node_modules/jsdoc-typeof-plugin"
],
"recurseDepth": 10,
"source": {
Expand All @@ -10,7 +11,7 @@
"sourceType": "module",
"tags": {
"allowUnknownTags": true,
"dictionaries": ["jsdoc","closure"]
"dictionaries": ["jsdoc", "closure"]
},
"templates": {
"cleverLinks": false,
Expand All @@ -22,4 +23,4 @@
"recurse": true,
"template": "./node_modules/@playcanvas/jsdoc-template"
}
}
}
5 changes: 0 additions & 5 deletions examples/src/examples/animation/blend-trees-1d.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,10 @@ async function example({ canvas, deviceType, assetPath, scriptsPath, data, glsla
createOptions.graphicsDevice = device;

createOptions.componentSystems = [
// @ts-ignore
pc.RenderComponentSystem,
// @ts-ignore
pc.CameraComponentSystem,
// @ts-ignore
pc.LightComponentSystem,
// @ts-ignore
pc.ScriptComponentSystem,
// @ts-ignore
pc.AnimComponentSystem
];
createOptions.resourceHandlers = [
Expand Down
5 changes: 0 additions & 5 deletions examples/src/examples/animation/blend-trees-2d-cartesian.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -150,15 +150,10 @@ async function example({ canvas, deviceType, assetPath, scriptsPath, glslangPath
createOptions.elementInput = new pc.ElementInput(canvas);

createOptions.componentSystems = [
// @ts-ignore
pc.RenderComponentSystem,
// @ts-ignore
pc.CameraComponentSystem,
// @ts-ignore
pc.LightComponentSystem,
// @ts-ignore
pc.ScriptComponentSystem,
// @ts-ignore
pc.AnimComponentSystem
];
createOptions.resourceHandlers = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,15 +107,10 @@ async function example({ canvas, deviceType, assetPath, glslangPath, twgslPath,
createOptions.elementInput = new pc.ElementInput(canvas);

createOptions.componentSystems = [
// @ts-ignore
pc.RenderComponentSystem,
// @ts-ignore
pc.CameraComponentSystem,
// @ts-ignore
pc.LightComponentSystem,
// @ts-ignore
pc.ScriptComponentSystem,
// @ts-ignore
pc.AnimComponentSystem
];
createOptions.resourceHandlers = [
Expand Down
4 changes: 0 additions & 4 deletions examples/src/examples/animation/component-properties.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,9 @@ async function example({ canvas, deviceType, data, assetPath, glslangPath, twgsl
createOptions.elementInput = new pc.ElementInput(canvas);

createOptions.componentSystems = [
// @ts-ignore
pc.RenderComponentSystem,
// @ts-ignore
pc.CameraComponentSystem,
// @ts-ignore
pc.LightComponentSystem,
// @ts-ignore
pc.AnimComponentSystem
];
createOptions.resourceHandlers = [
Expand Down
5 changes: 0 additions & 5 deletions examples/src/examples/animation/events.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,10 @@ async function example({ canvas, deviceType, assetPath, glslangPath, twgslPath,
createOptions.elementInput = new pc.ElementInput(canvas);

createOptions.componentSystems = [
// @ts-ignore
pc.RenderComponentSystem,
// @ts-ignore
pc.CameraComponentSystem,
// @ts-ignore
pc.LightComponentSystem,
// @ts-ignore
pc.ScriptComponentSystem,
// @ts-ignore
pc.AnimComponentSystem
];
createOptions.resourceHandlers = [
Expand Down
5 changes: 0 additions & 5 deletions examples/src/examples/animation/layer-masks.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -112,15 +112,10 @@ async function example({ canvas, deviceType, assetPath, scriptsPath, glslangPath
createOptions.touch = new pc.TouchDevice(document.body);

createOptions.componentSystems = [
// @ts-ignore
pc.RenderComponentSystem,
// @ts-ignore
pc.CameraComponentSystem,
// @ts-ignore
pc.LightComponentSystem,
// @ts-ignore
pc.ScriptComponentSystem,
// @ts-ignore
pc.AnimComponentSystem
];
createOptions.resourceHandlers = [
Expand Down
7 changes: 0 additions & 7 deletions examples/src/examples/animation/locomotion.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -66,19 +66,12 @@ async function example({ canvas, deviceType, assetPath, ammoPath, glslangPath, t
createOptions.touch = new pc.TouchDevice(document.body);

createOptions.componentSystems = [
// @ts-ignore
pc.RenderComponentSystem,
// @ts-ignore
pc.CameraComponentSystem,
// @ts-ignore
pc.LightComponentSystem,
// @ts-ignore
pc.ScriptComponentSystem,
// @ts-ignore
pc.AnimComponentSystem,
// @ts-ignore
pc.CollisionComponentSystem,
// @ts-ignore
pc.RigidBodyComponentSystem
];
createOptions.resourceHandlers = [
Expand Down
5 changes: 0 additions & 5 deletions examples/src/examples/animation/tween.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,10 @@ async function example({ canvas, deviceType, assetPath, scriptsPath, glslangPath
createOptions.graphicsDevice = device;

createOptions.componentSystems = [
// @ts-ignore
pc.RenderComponentSystem,
// @ts-ignore
pc.CameraComponentSystem,
// @ts-ignore
pc.LightComponentSystem,
// @ts-ignore
pc.ScriptComponentSystem,
// @ts-ignore
pc.ElementComponentSystem
];
createOptions.resourceHandlers = [
Expand Down
3 changes: 0 additions & 3 deletions examples/src/examples/graphics/area-lights.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,8 @@ async function example({ canvas, deviceType, assetPath, glslangPath, twgslPath }
createOptions.touch = new pc.TouchDevice(document.body);

createOptions.componentSystems = [
// @ts-ignore
pc.RenderComponentSystem,
// @ts-ignore
pc.CameraComponentSystem,
// @ts-ignore
pc.LightComponentSystem
];
createOptions.resourceHandlers = [
Expand Down
3 changes: 0 additions & 3 deletions examples/src/examples/graphics/area-picker.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,8 @@ async function example({ canvas, deviceType, assetPath, glslangPath, twgslPath,
createOptions.touch = new pc.TouchDevice(document.body);

createOptions.componentSystems = [
// @ts-ignore
pc.RenderComponentSystem,
// @ts-ignore
pc.CameraComponentSystem,
// @ts-ignore
pc.ScriptComponentSystem
];
createOptions.resourceHandlers = [
Expand Down
7 changes: 1 addition & 6 deletions examples/src/examples/graphics/asset-viewer.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function controls({ observer, ReactPCUI, React, jsx, fragment }) {
/**
* @param {import('../../options.mjs').ExampleOptions} options - The example options.
* @returns {Promise<pc.AppBase>} The example application.
*/
*/
async function example({ canvas, deviceType, data, assetPath, scriptsPath, glslangPath, twgslPath }) {

const assets = {
Expand Down Expand Up @@ -51,15 +51,10 @@ async function example({ canvas, deviceType, data, assetPath, scriptsPath, glsla
createOptions.keyboard = new pc.Keyboard(document.body);

createOptions.componentSystems = [
// @ts-ignore
pc.RenderComponentSystem,
// @ts-ignore
pc.CameraComponentSystem,
// @ts-ignore
pc.LightComponentSystem,
// @ts-ignore
pc.ScriptComponentSystem,
// @ts-ignore
pc.ElementComponentSystem
];
createOptions.resourceHandlers = [
Expand Down
3 changes: 0 additions & 3 deletions examples/src/examples/graphics/batching-dynamic.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,8 @@ async function example({ canvas, deviceType, glslangPath, twgslPath }) {
createOptions.batchManager = pc.BatchManager;

createOptions.componentSystems = [
// @ts-ignore
pc.RenderComponentSystem,
// @ts-ignore
pc.CameraComponentSystem,
// @ts-ignore
pc.LightComponentSystem
];

Expand Down
4 changes: 0 additions & 4 deletions examples/src/examples/graphics/clustered-area-lights.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,9 @@ async function example({ canvas, deviceType, assetPath, scriptsPath, glslangPath
createOptions.touch = new pc.TouchDevice(document.body);

createOptions.componentSystems = [
// @ts-ignore
pc.RenderComponentSystem,
// @ts-ignore
pc.CameraComponentSystem,
// @ts-ignore
pc.LightComponentSystem,
// @ts-ignore
pc.ScriptComponentSystem
];
createOptions.resourceHandlers = [
Expand Down
4 changes: 0 additions & 4 deletions examples/src/examples/graphics/clustered-lighting.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,9 @@ async function example({ canvas, deviceType, assetPath, glslangPath, twgslPath,
createOptions.touch = new pc.TouchDevice(document.body);

createOptions.componentSystems = [
// @ts-ignore
pc.RenderComponentSystem,
// @ts-ignore
pc.CameraComponentSystem,
// @ts-ignore
pc.LightComponentSystem,
// @ts-ignore
pc.ScriptComponentSystem
];
createOptions.resourceHandlers = [
Expand Down
6 changes: 1 addition & 5 deletions examples/src/examples/graphics/clustered-omni-shadows.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ function controls({ observer, ReactPCUI, React, jsx, fragment }) {
/**
* @param {import('../../options.mjs').ExampleOptions} options - The example options.
* @returns {Promise<pc.AppBase>} The example application.
*/
*/
async function example({ canvas, deviceType, data, assetPath, scriptsPath, glslangPath, twgslPath }) {

const assets = {
Expand All @@ -74,13 +74,9 @@ async function example({ canvas, deviceType, data, assetPath, scriptsPath, glsla
createOptions.touch = new pc.TouchDevice(document.body);

createOptions.componentSystems = [
// @ts-ignore
pc.RenderComponentSystem,
// @ts-ignore
pc.CameraComponentSystem,
// @ts-ignore
pc.LightComponentSystem,
// @ts-ignore
pc.ScriptComponentSystem
];
createOptions.resourceHandlers = [
Expand Down
6 changes: 1 addition & 5 deletions examples/src/examples/graphics/clustered-spot-shadows.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ function controls({ observer, ReactPCUI, React, jsx, fragment }) {
/**
* @param {import('../../options.mjs').ExampleOptions} options - The example options.
* @returns {Promise<pc.AppBase>} The example application.
*/
*/
async function example({ canvas, deviceType, data, assetPath, scriptsPath, glslangPath, twgslPath }) {
const observer = data;
const assets = {
Expand All @@ -130,13 +130,9 @@ async function example({ canvas, deviceType, data, assetPath, scriptsPath, glsla
createOptions.touch = new pc.TouchDevice(document.body);

createOptions.componentSystems = [
// @ts-ignore
pc.RenderComponentSystem,
// @ts-ignore
pc.CameraComponentSystem,
// @ts-ignore
pc.LightComponentSystem,
// @ts-ignore
pc.ScriptComponentSystem
];
createOptions.resourceHandlers = [
Expand Down
7 changes: 1 addition & 6 deletions examples/src/examples/graphics/contact-hardening-shadows.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ function controls({ observer, ReactPCUI, React, jsx, fragment }) {
/**
* @param {import('../../options.mjs').ExampleOptions} options - The example options.
* @returns {Promise<pc.AppBase>} The example application.
*/
*/
async function example({ canvas, deviceType, data, assetPath, scriptsPath, glslangPath, twgslPath, dracoPath }) {

pc.WasmModule.setConfig('DracoDecoderModule', {
Expand Down Expand Up @@ -153,15 +153,10 @@ async function example({ canvas, deviceType, data, assetPath, scriptsPath, glsla
createOptions.touch = new pc.TouchDevice(document.body);

createOptions.componentSystems = [
// @ts-ignore
pc.RenderComponentSystem,
// @ts-ignore
pc.CameraComponentSystem,
// @ts-ignore
pc.LightComponentSystem,
// @ts-ignore
pc.ScriptComponentSystem,
// @ts-ignore
pc.AnimComponentSystem
];
createOptions.resourceHandlers = [
Expand Down
2 changes: 0 additions & 2 deletions examples/src/examples/graphics/grab-pass.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@ async function example({ canvas, deviceType, files, assetPath, glslangPath, twgs
createOptions.touch = new pc.TouchDevice(document.body);

createOptions.componentSystems = [
// @ts-ignore
pc.RenderComponentSystem,
// @ts-ignore
pc.CameraComponentSystem
];
createOptions.resourceHandlers = [
Expand Down
4 changes: 0 additions & 4 deletions examples/src/examples/graphics/ground-fog.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,9 @@ async function example({ canvas, deviceType, files, assetPath, scriptsPath, glsl
createOptions.touch = new pc.TouchDevice(document.body);

createOptions.componentSystems = [
// @ts-ignore
pc.RenderComponentSystem,
// @ts-ignore
pc.CameraComponentSystem,
// @ts-ignore
pc.LightComponentSystem,
// @ts-ignore
pc.ScriptComponentSystem
];
createOptions.resourceHandlers = [
Expand Down
2 changes: 0 additions & 2 deletions examples/src/examples/graphics/hardware-instancing.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ async function example({ canvas, deviceType, assetPath, glslangPath, twgslPath }
createOptions.graphicsDevice = device;

createOptions.componentSystems = [
// @ts-ignore
pc.RenderComponentSystem,
// @ts-ignore
pc.CameraComponentSystem
];
createOptions.resourceHandlers = [
Expand Down
3 changes: 0 additions & 3 deletions examples/src/examples/graphics/hierarchy.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,8 @@ async function example({ canvas, deviceType, glslangPath, twgslPath }) {
createOptions.graphicsDevice = device;

createOptions.componentSystems = [
// @ts-ignore
pc.RenderComponentSystem,
// @ts-ignore
pc.CameraComponentSystem,
// @ts-ignore
pc.LightComponentSystem
];

Expand Down
3 changes: 0 additions & 3 deletions examples/src/examples/graphics/layers.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,8 @@ async function example({ canvas, deviceType, glslangPath, twgslPath }) {
createOptions.graphicsDevice = device;

createOptions.componentSystems = [
// @ts-ignore
pc.RenderComponentSystem,
// @ts-ignore
pc.CameraComponentSystem,
// @ts-ignore
pc.LightComponentSystem
];

Expand Down
6 changes: 1 addition & 5 deletions examples/src/examples/graphics/light-physical-units.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ function controls({ observer, ReactPCUI, React, jsx, fragment }) {
/**
* @param {import('../../options.mjs').ExampleOptions} options - The example options.
* @returns {Promise<pc.AppBase>} The example application.
*/
*/
async function example({ canvas, deviceType, data, assetPath, scriptsPath, glslangPath, twgslPath }) {

const assets = {
Expand Down Expand Up @@ -137,13 +137,9 @@ async function example({ canvas, deviceType, data, assetPath, scriptsPath, glsla
createOptions.touch = new pc.TouchDevice(document.body);

createOptions.componentSystems = [
// @ts-ignore
pc.RenderComponentSystem,
// @ts-ignore
pc.CameraComponentSystem,
// @ts-ignore
pc.LightComponentSystem,
// @ts-ignore
pc.ScriptComponentSystem
];
createOptions.resourceHandlers = [
Expand Down
Loading

0 comments on commit 201cbc0

Please sign in to comment.