Socket
Socket
Sign inDemoInstall

ts2gamesparks

Package Overview
Dependencies
22
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    ts2gamesparks

### Install ts2gamesparks ```console $ npm install -g ts2gamesparks ```


Version published
Weekly downloads
4
increased by300%
Maintainers
1
Install size
39.5 MB
Created
Weekly downloads
 

Readme

Source

Installing

Install ts2gamesparks

$ npm install -g ts2gamesparks

Install GameSparks typings

$ npm install --save-dev gamesparks-typings

Add to tsconfig.json

// tsconfig.json
{
  "compilerOptions": {
	...
    "types": [
      "gamesparks-typings"
    ],
  }
}

Init tsconfig files

$ mkdir src && cd src
$ ts2gs --init

These three files will be created:

  • src/tsconfig.json
  • src/rtScript/tsconfig.json
  • src/rtModules/tsconfig.json

If you are not sure, please do not modify these files.

Using

Prevent global namespace pollution

If the script does not import or export anything, the script will not be recognized as a module, and the variables in the script will exist in the global namespace. In order to solve it, just add export { } to the first line of the script.

Export something

:warning: Do not use export in directories other than modules/ and rtModules/

// src/modules/foo.ts

export function func() {
	/* ... */
}
export const bar = "bar"

Import something

:white_check_mark: Do it

import /* ... */ from "foo";

:x: Don't do it!

import /* ... */ from "./foo";
import /* ... */ from "../modules/foo";

Output javascript

When tsconfig.json under root directory

$ ts2gs

When tsconfig.json under ./src

$ cd src && ts2gs

Example

https://github.com/johnsoncodehk/gamesparks-cloud-code-typescript-example

FAQs

Last updated on 22 Aug 2020

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc