Skip to content

Commit

Permalink
feat: allow passing custom properties types to objects
Browse files Browse the repository at this point in the history
  • Loading branch information
trezy committed Dec 19, 2024
1 parent 82621df commit 14927ab
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 10 deletions.
5 changes: 3 additions & 2 deletions src/typedefs/Ellipse.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
// Local imports
import { TiledObject } from './TiledObject';
import { CustomProperties } from './CustomProperties'
import { TiledObject } from './TiledObject'





export interface Ellipse extends TiledObject {
export interface Ellipse<CustomPropertiesType extends CustomProperties = CustomProperties> extends TiledObject<CustomPropertiesType> {
height: number,

type: 'ellipse',
Expand Down
5 changes: 3 additions & 2 deletions src/typedefs/Point.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
// Local imports
import { TiledObject } from './TiledObject';
import { CustomProperties } from './CustomProperties'
import { TiledObject } from './TiledObject'





export interface Point extends TiledObject {
export interface Point<CustomPropertiesType extends CustomProperties = CustomProperties> extends TiledObject<CustomPropertiesType> {
type: 'point',
}
5 changes: 3 additions & 2 deletions src/typedefs/Polygon.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
// Local imports
import { TiledObject } from './TiledObject';
import { CustomProperties } from './CustomProperties'
import { TiledObject } from './TiledObject'
import { Vector2 } from './Vector2'





export interface Polygon extends TiledObject {
export interface Polygon<CustomPropertiesType extends CustomProperties = CustomProperties> extends TiledObject<CustomPropertiesType> {
points: Vector2[],

type: 'polygon',
Expand Down
5 changes: 3 additions & 2 deletions src/typedefs/Rectangle.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
// Local imports
import { TiledObject } from './TiledObject';
import { CustomProperties } from './CustomProperties'
import { TiledObject } from './TiledObject'





export interface Rectangle extends TiledObject {
export interface Rectangle<CustomPropertiesType extends CustomProperties = CustomProperties> extends TiledObject<CustomPropertiesType> {
height: number,

type: 'rectangle',
Expand Down
4 changes: 2 additions & 2 deletions src/typedefs/TiledObject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import { type Vector2 } from './Vector2'



export interface TiledObject extends Vector2{
export interface TiledObject<CustomPropertiesType extends CustomProperties = CustomProperties> extends Vector2 {
class?: string,

customProperties?: CustomProperties,
customProperties?: CustomPropertiesType,

id: number,

Expand Down

0 comments on commit 14927ab

Please sign in to comment.