Skip to content

README mentions adding a tsconfig.json, but doesn't say what to put in it #29

Open
@richardbarrell-calvium

Description

@richardbarrell-calvium

If I add a tsconfig.json, I need to put roughly the following in it:

{
  "compilerOptions": {
    "strict": true,
    "lib": ["DOM", "DOM.Iterable", "ES6"],
    "esModuleInterop": true,
    "resolveJsonModule": true
  },
  "exclude": ["node_modules", "dist"],
  "include": [".marko-run/routes.d.ts", "src"]
}

If I omit "lib", I'll get TS errors telling me that Promise isn't defined. (You can use something more aggressive than ES2019 if you're targeting modern browsers, but ES6 happens to be the minimum for Promise.)

If I omit either "esModuleInterop" or "resolveJsonModule", I see type errors in the example project, because the file generated in .marko-run/routes.d.ts isn't parsed by typescript, so none of my per-route types seem to be visible in VS Code.

I'm going to suggest adding an example tsconfig.json file?

edit: I thought these were needed but they actually aren't:

    "allowSyntheticDefaultImports": true,
    "moduleResolution": "node",

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions