JoshuaKGoldberg / JoshuaKGoldberg/TypeStat

Warn or error on semantic diagnostics when creating a program

Open
#764 0 comments 0 reactions 0 assignees View on GitHub
area: architecture status: needs investigation type: enhancement
Dominant language
TypeScript
Stars
2.3k
Forks
47
Avg merge
15h 55m
Merged PRs (30d)
21

Description

### 🚀 Feature Request

It'd be nice to know when there are TypeScript program/semantic/etc. diagnostics before running, instead of just getting relatively poor quality fixes?

#### Existing Behavior

I've had troubles getting types working properly with third party definitions: first in the wrestling that spawned #758+#759, then later in tests where I'd forgotten to enable compiler options like `"jsx": "react"` & `"esmoduleInterop": true` when working with `import React from "react";`. Nothing told me there was anything wrong until I explicitly ran `request.program.services.getSemanticDiagnostics(someNode.getSourceFile());`

#### Change Proposal

Maybe warn on them before running? Maybe error out instead of executing in tests, or even in general CLI usage?

Note that some (even many) diagnostics are expected in e.g. tests that add in missing props, types, etc. So part of this would would need to be filtering existing diagnostics for the ones that aren't expected.

I wonder if #759 could be reverted after this change...

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.