{"id":18917496,"url":"https://github.com/aikoven/slice2ts","last_synced_at":"2025-07-12T20:33:55.136Z","repository":{"id":41812630,"uuid":"115505769","full_name":"aikoven/slice2ts","owner":"aikoven","description":"Compiles Slice files to TypeScript.","archived":false,"fork":false,"pushed_at":"2023-02-17T07:37:02.000Z","size":1145,"stargazers_count":2,"open_issues_count":3,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-28T19:39:06.282Z","etag":null,"topics":["ice","slice","typescript","zeroc"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aikoven.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-12-27T09:38:55.000Z","updated_at":"2022-06-15T00:25:27.000Z","dependencies_parsed_at":"2024-11-08T10:33:03.867Z","dependency_job_id":"312f2016-eaad-4979-86b0-f6b9404b5d4c","html_url":"https://github.com/aikoven/slice2ts","commit_stats":{"total_commits":80,"total_committers":5,"mean_commits":16.0,"dds":0.375,"last_synced_commit":"5845fcc6f4160e1b029cba5cf8b81f51ec42b506"},"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aikoven%2Fslice2ts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aikoven%2Fslice2ts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aikoven%2Fslice2ts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aikoven%2Fslice2ts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aikoven","download_url":"https://codeload.github.com/aikoven/slice2ts/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249042973,"owners_count":21203389,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ice","slice","typescript","zeroc"],"created_at":"2024-11-08T10:26:32.816Z","updated_at":"2025-04-15T09:32:02.370Z","avatar_url":"https://github.com/aikoven.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# slice2ts [![npm version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url]\n\nCompiles Slice files to TypeScript.\n\n## Installation\n\n    $ npm install -D slice2ts\n\n## Usage\n\n    Usage: slice2ts [options] \u003cfile ...\u003e\n\n    Options:\n\n      -V, --version         output the version number\n      --root-dir \u003cdir\u003e      Root dirs.\n                            Output files will have the same structure as source files relative to root dirs.\n                            Ice includes are also resolved in these dirs.\n      -e, --exclude \u003cfile\u003e  File paths or globs to exclude.\n      -o, --out-dir \u003cdir\u003e   Directory where to put generated files.\n      --no-js               If true, only the typings are generated.\n      --ice-imports         If true, Ice modules are imported from particular files instead of \"ice\".\n      -i, --ignore \u003ctype\u003e   Don't generate typings for these types.\n      --index               If true, generates index file for each top-level slice module.\n      --no-nullable-values  If true, don't generate `| null` for fields and parameters whose type is Value.\n      -h, --help            output usage information\n\n## API\n\n```ts\nimport {slice2ts} from 'slice2ts';\n\nslice2ts(options); // Promise\u003cvoid\u003e;\n```\n\nOptions interface:\n\n```ts\n{\n  /**\n   * Array of slice file paths or globs.\n   */\n  files: string[];\n  /**\n   * Array of file paths or globs to exclude.\n   */\n  exclude?: string[];\n  /**\n   * Array of root dirs.\n   * Output files will have the same structure as source files relative to root\n   * dirs.\n   * Ice includes are also resolved in these dirs.\n   */\n  rootDirs: string[];\n  /**\n   * Directory where to put generated files.\n   */\n  outDir: string;\n  /**\n   * If true, only typings are generated.\n   */\n  noJs?: boolean;\n  /**\n   * If true, Ice modules are imported from particular files instead of \"ice\".\n   */\n  iceImports?: boolean;\n  /**\n   * Don't generate typings for these types.\n   */\n  ignore?: string[];\n  /**\n   * If true, generates index file for each top-level slice module.\n   */\n  index?: boolean;\n  /**\n   * If true, don't generate `| null` for fields and parameters whose type is\n   * Value.\n   */\n  noNullableValues?: boolean;\n}\n```\n\n## Metadata Directives\n\n* `ts:type:\u003ctype\u003e`\n\n  Overrides generated type for fields, operation parameters or operation return\n  values:\n\n  ```slice\n  class AbstractBase {};\n  class A extends AbstractBase {};\n  class B extends AbstractBase {};\n\n  struct S {\n    [\"ts:type:A|B\"]\n    AbstractBase field;\n  };\n\n  class C {\n    [\"ts:type:A|B\"]\n    AbstractBase field1;\n\n    [\"ts:type:A|B\"]\n    optional(1) AbstractBase field2;\n  };\n\n  interface I {\n    [\"ts:type:A|B\"] AbstractBase operation(\n      [\"ts:type:A|B\"] AbstractBase arg1,\n      [\"ts:type:A|B\"] optional(1) AbstractBase arg2\n    );\n  };\n  ```\n\n  Outputs:\n\n  ```ts\n  class AbstractBase extends Ice.Value {}\n  class A extends AbstractBase {}\n  class B extends AbstractBase {}\n\n  class S implements Ice.Struct {\n    constructor(field?: A | B);\n\n    field: A | B;\n\n    clone(): this;\n    equals(other: this): boolean;\n    hashCode(): number;\n  }\n\n  class C extends Ice.Value {\n    constructor(field1?: A | B, field2?: A | B | undefined);\n\n    field1: A | B;\n    field2?: A | B;\n  }\n\n  abstract class I extends Ice.Object {\n    abstract operation(\n      arg1: A | B,\n      arg2: A | B | undefined,\n      current: Ice.Current,\n    ): Ice.OperationResult\u003cA | B\u003e;\n  }\n\n  class IPrx extends Ice.ObjectPrx {\n    operation(\n      arg1: A | B,\n      arg2?: A | B,\n      ctx?: Ice.Context,\n    ): Ice.AsyncResult\u003cA | B\u003e;\n  }\n  ```\n\n* `ts:generic:\u003ctype parameters\u003e`\n\n  Adds generic parameters for types generated from sequences, dictionaries,\n  classes and interfaces:\n\n  ```slice\n  [\"ts:generic:T extends Ice.Value\"]\n  sequence\u003c[\"ts:type:T\"] Object\u003e GenericSeq;\n\n  [\"ts:generic:T extends Ice.Value\"]\n  dictionary\u003cstring, [\"ts:type:T\"] Object\u003e GenericDict;\n\n  [\"ts:generic:T extends Ice.Value\"]\n  class GenericClass {\n    [\"ts:type:T\"]\n    Object field;\n  };\n\n  [\"ts:generic:T extends Ice.Value\"]\n  interface GenericInterface {\n    [\"ts:type:GenericClass\u003cT\u003e\"] GenericClass operation(\n      [\"ts:type:GenericSeq\u003cT\u003e\"] GenericSeq arg\n    );\n  };\n  ```\n\n  Outputs:\n\n  ```ts\n  type GenericSeq\u003cT extends Ice.Value\u003e = Array\u003cT\u003e;\n\n  type GenericDict\u003cT extends Ice.Value\u003e = Map\u003cstring, T\u003e;\n  const GenericDict: {\n    new \u003cT extends Ice.Value\u003e(entries?: ReadonlyArray\u003c[string, T]\u003e): Map\u003c\n      string,\n      T\n    \u003e;\n  };\n\n  class GenericClass\u003cT extends Ice.Value\u003e extends Ice.Value {\n    constructor(field?: T);\n\n    field: T;\n  }\n\n  abstract class GenericInterface\u003cT extends Ice.Value\u003e extends Ice.Object {\n    abstract operation(\n      arg: GenericSeq\u003cT\u003e,\n      current: Ice.Current,\n    ): Ice.OperationResult\u003cGenericClass\u003cT\u003e\u003e;\n  }\n\n  class GenericInterfacePrx\u003cT extends Ice.Value\u003e extends Ice.ObjectPrx {\n    operation(\n      arg: GenericSeq\u003cT\u003e,\n      ctx?: Ice.Context,\n    ): Ice.AsyncResult\u003cGenericClass\u003cT\u003e\u003e;\n  }\n  ```\n\n[npm-image]: https://badge.fury.io/js/slice2ts.svg\n[npm-url]: https://badge.fury.io/js/slice2ts\n[travis-image]: https://travis-ci.org/aikoven/slice2ts.svg?branch=master\n[travis-url]: https://travis-ci.org/aikoven/slice2ts\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faikoven%2Fslice2ts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faikoven%2Fslice2ts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faikoven%2Fslice2ts/lists"}