Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeScript Support #9

Merged
merged 4 commits into from
Sep 26, 2024
Merged

TypeScript Support #9

merged 4 commits into from
Sep 26, 2024

Conversation

marklundin
Copy link
Member

@marklundin marklundin commented Sep 11, 2024

This PR adds support for declaring script attribute via TypeScript. Tests included

import { Script } from 'playcanvas'

export class My extends Script {
  /** @attribute */
  num : Number = 10

  /** @attribute */
  str : String = 'hello'
} 

It also adds supports for declaring enums and interfaces

import { Script } from 'playcanvas'

enum Options { OFF, ON, UNKNOWN }

interface Enemy {
  speed : Number
  boost: Boolean
}

export class My extends Script {
  /** @attribute */
  opts : Options
  
  /** @attribute */
  enemies : Enemy[]
} 

@marklundin marklundin changed the title Adds TypeScript Support TypeScript Support Sep 11, 2024
@marklundin marklundin requested a review from a team September 18, 2024 10:42
@marklundin marklundin merged commit e1876a2 into main Sep 26, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants