MenuTroubleshooting / My TypeScript did not run because of a type error

Docs / Troubleshooting

My TypeScript did not run because of a type error

With “Don’t run with type errors” on, a TypeScript Snippet with a type error prints the error instead of running.

On this page

Why it did not run

You turned on Settings → Running → Don’t run with type errors. With it on, JSpark checks a TypeScript Snippet before each Run. If it finds a type error, nothing runs:

  • The console prints each error on its own line, such as Line 5: Type 'string' is not assignable to type 'number'.
  • The footer says Didn’t run.
  • The error is underlined in the editor.
The type error is printed in the console, and the footer says Didn’t run.

The setting is off by default. It never holds a JavaScript Snippet. In a Vue or Svelte component, it counts only when the component’s script is TypeScript (lang="ts").

Run as you type still runs. Each time, the Run prints the errors again, until the code has none.

Fix the error

  1. Click the error in the console. The cursor goes to that line.
  2. Fix the code. Hover the underline to read the error there too.
  3. Press ⌘↵ or Ctrl+Enter, or wait for Run as you type.

When the code has no type errors, it runs as usual.

Or run with type errors

To run code that has type errors, turn the setting off:

  1. Open Settings with ⌘, or Ctrl+,.
  2. Go to Running.
  3. Turn off Don’t run with type errors.

Type errors are then underlined, and the code runs anyway. The change applies to the next Run in every open tab. See JavaScript and TypeScript.

The pictures show JSpark on a Mac. On Windows, the window buttons are at the top right, the menus are in theMenu button at the left end of the tabs, and shortcuts use Ctrl where a Mac uses ⌘. The rest works the same way.

Esc

Type to search every docs page.

JSpark is downloading

When you open JSpark-Setup.exe, Windows may stop it once, because the installer isn’t code-signed yet. If the file came from jspark.app:

A blue Windows box, “Windows protected your PC”: Microsoft Defender SmartScreen prevented an unrecognised app from starting. Under it, the link More info, and the button Don’t run.

1Click More info.

The same box after More info: Application JSpark-Setup-1.4.0.exe, Publisher Unknown publisher, and the buttons Run anyway and Don’t run.

2Then click Run anyway.

You see this only once: updates install inside the app. More in Install JSpark.