-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
97 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 20 additions & 4 deletions
24
src/foundry/client-esm/canvas/sources/point-movement-source.d.mts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,31 @@ | ||
import type BaseEffectSource from "./base-effect-source.d.mts"; | ||
import type PointEffectSourceMixin from "./point-effect-source.d.mts"; | ||
|
||
type MovementSourceData = PointEffectSourceMixin.SourceData & BaseEffectSource.SourceData; | ||
|
||
/** | ||
* A specialized subclass of the BaseEffectSource which describes a movement-based source. | ||
*/ | ||
export default class PointMovementSource< | ||
SourceData extends MovementSourceData = MovementSourceData, | ||
declare class PointMovementSource< | ||
SourceData extends PointMovementSource.SourceData = PointMovementSource.SourceData, | ||
SourceShape extends PointSourcePolygon = PointSourcePolygon, | ||
> extends PointEffectSourceMixin(BaseEffectSource)<SourceData, SourceShape> { | ||
/** @defaultValue `"move"` */ | ||
static override sourceType: string; | ||
|
||
/** | ||
* @privateRemarks This is not in foundry's code, but since this class (and its parent) implements `_createShapes`, | ||
* and we are counting what happens in `initialize` as 'the constructor', this gets to be declared never undefined. | ||
*/ | ||
override shape: SourceShape; | ||
} | ||
|
||
declare namespace PointMovementSource { | ||
type AnyConstructor = typeof AnyPointMovementSource; | ||
|
||
type SourceData = PointEffectSourceMixin.MixedSourceData; | ||
} | ||
|
||
declare abstract class AnyPointMovementSource extends PointMovementSource { | ||
constructor(arg0: never, ...args: never[]); | ||
} | ||
|
||
export default PointMovementSource; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 4 additions & 3 deletions
7
tests/foundry/client-esm/canvas/sources/point-movement-source.mjs.test-d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
import { expectTypeOf } from "vitest"; | ||
import type PointMovementSource from "../../../../../src/foundry/client-esm/canvas/sources/point-movement-source.d.mts"; | ||
|
||
const mySource = new foundry.canvas.sources.PointMovementSource(); | ||
|
||
expectTypeOf(mySource.active).toEqualTypeOf<boolean>(); | ||
expectTypeOf( | ||
mySource.initialize({ x: 3, y: 5, elevation: 7 }), | ||
).toEqualTypeOf<foundry.canvas.sources.PointMovementSource>(); | ||
expectTypeOf(mySource.initialize({ x: 3, y: 5, elevation: 7 })).toEqualTypeOf<PointMovementSource>(); | ||
expectTypeOf(mySource.shape).toEqualTypeOf<PointSourcePolygon>(); | ||
expectTypeOf(mySource.data).toEqualTypeOf<PointMovementSource.SourceData>(); |
7 changes: 4 additions & 3 deletions
7
tests/foundry/client-esm/canvas/sources/point-sound-source.mjs.test-d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
import { expectTypeOf } from "vitest"; | ||
import type PointSoundSource from "../../../../../src/foundry/client-esm/canvas/sources/point-sound-source.d.mts"; | ||
|
||
const mySource = new foundry.canvas.sources.PointSoundSource(); | ||
|
||
expectTypeOf(mySource.active).toEqualTypeOf<boolean>(); | ||
expectTypeOf( | ||
mySource.initialize({ radius: 5, walls: true, disabled: false }), | ||
).toEqualTypeOf<foundry.canvas.sources.PointSoundSource>(); | ||
expectTypeOf(mySource.initialize({ radius: 5, walls: true, disabled: false })).toEqualTypeOf<PointSoundSource>(); | ||
expectTypeOf(mySource.shape).toEqualTypeOf<PointSourcePolygon>(); | ||
expectTypeOf(mySource.data).toEqualTypeOf<PointSoundSource.SourceData>(); |
6 changes: 5 additions & 1 deletion
6
tests/foundry/client-esm/canvas/sources/point-vision-source.mjs.test-d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,10 @@ | ||
import { expectTypeOf } from "vitest"; | ||
import type PointVisionSource from "../../../../../src/foundry/client-esm/canvas/sources/point-vision-source.d.mts"; | ||
|
||
const mySource = new foundry.canvas.sources.PointVisionSource(); | ||
|
||
expectTypeOf(mySource.active).toEqualTypeOf<boolean>(); | ||
expectTypeOf(mySource.drawMeshes().background.visible).toEqualTypeOf<boolean>(); | ||
expectTypeOf(mySource.drawMeshes().background?.visible).toEqualTypeOf<boolean | undefined>(); | ||
expectTypeOf(mySource.data).toEqualTypeOf<PointVisionSource.SourceData>(); | ||
expectTypeOf(mySource.shape).toEqualTypeOf<PointSourcePolygon>(); | ||
expectTypeOf(mySource._configureShaders().background).toEqualTypeOf<typeof AdaptiveVisionShader>(); |