Skip to content

[question] Is it possible to create a index.ts for both lua and js? #1681

@Freed-Wu

Description

@Freed-Wu

Expected behaviour

export async function f(this: void, filename: string) {
  let text;
  if (io !== undefined) {
    const f = io.open(filename)[0];
    if (f) {
      text = f.read("*a");
      f.close();
    }
  } else {
    const fs = require('fs');
    text = String(fs.readSync())
  }
  return `file is ${text}!`
}

Then run tstl to get lua and tsc to get js.

Actual behaviour

    "types": ["lua-types/5.1", "@types/node"],

Seems to be a conflict.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions