https://github.com/positlabs/spark-typescript
Typescript compiler example for Spark AR
https://github.com/positlabs/spark-typescript
Last synced: 3 months ago
JSON representation
Typescript compiler example for Spark AR
- Host: GitHub
- URL: https://github.com/positlabs/spark-typescript
- Owner: positlabs
- Created: 2020-04-09T17:56:46.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2021-02-08T18:36:40.000Z (over 4 years ago)
- Last Synced: 2024-10-19T07:07:24.918Z (7 months ago)
- Language: JavaScript
- Size: 329 KB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
Awesome Lists containing this project
README
## Typescript for Spark AR
UPDATE: v106+ supports typescript natively

Out of the box, the Spark AR JS runtime doesn't support things like async/await, or Array.includes. This project shows how to configure the tsconfig so it will compile your modern JS into something that plays nicely with Spark.
It's a bit of a hack, since there's not a complete source for Spark types, but they are referenced in the default tsconfig that is generated when you add a script to your project. As a result, typescript will complain about missing references. As far as I can tell, the compiler works fine, but the type checker will complain every time.
### Dependencies
Install [NodeJS](https://nodejs.org/en/) LTS.
Install the dependencies:
- `cd scripts`
- `npm i`### Development
Run `npm start` from the scripts dir to watch src/script.js for changes, and recompile during development.
## Resources
Related: https://github.com/mikkoh/ts-spark-ar
Learn more stuff by watching my [Spark AR Tutorials on YouTube!](https://www.youtube.com/playlist?list=PLAZp2Vi7Gfspzyla4RrCO6BzVzYW7Lnb-)
Follow me on Instagram [@positlabs](https://instagram.com/positlabs) and try out my effects!
Browse my open-source [Spark AR repositories on Github!](https://github.com/search?q=user%3Apositlabs+spark)
Have questions? Join the [Spark AR Community](https://www.facebook.com/groups/SparkARcommunity/) group on Facebook.
## Donations
If you used this in client projects, or simply enjoyed making effects with my open-source projects, please consider a donation or sponsorship. One-time donations can be made with PayPal. Subscriptions can be through PayPal or [Github Sponsorships](https://github.com/sponsors/positlabs).
[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YGS69CHAE9EQC&source=url)