char/avril

(wip) why'd you have to go and make things so complicaaaaated?

git clone https://git.t4t.associates/char/avril

Charlotte Somexperiment: automatic types for npm packages51266f9

main
1.9 KiB35 linesraw

Type checking

avril check type-checks an entry module and its whole Avril module graph without executing any of it:

avril check --typescript=/absolute/path/to/package/lib/tsc main.ts

--typescript=PATH names the same pinned, unmodified native TypeScript backend as avril lsp; see the download instructions. --typescript PATH is also accepted.

Checking shares the language server's resolution and compiler settings rather than a generated tsconfig.json: avril.conf import maps and package ownership, jsr:/npm:/https: dependencies, avril: builtin declarations, per-file JSX settings, and the cache/lock/vendor policy selected by the usual package flags (--offline, --frozen, --lock=PATH, --vendor=PATH, …). The types.imports map can redirect module resolution for types only, and types.globals explicitly lists global declaration modules; neither changes runtime imports, nor are npm packages automatically added as globals merely because they are present. npm @types discovery is recorded during add, cache, update, and vendor (including negative results), then replayed from the lock by check and the language server. Use avril cache main.ts to prepare it first, or --no-types-packages to disable automatic DefinitelyTyped lookup without disabling bundled or explicitly configured declarations. See npm type declarations. Capability flags (-0, --allow-*, --deny-*) apply as they do for avril cache. As with the language server, checking may populate the package cache but never writes lockfiles, tsconfigs, or application sources.

Diagnostics are printed one per line as path:line:column: error TS2322: message, using the original source locations. The command exits nonzero if any error is reported; warnings are printed but do not fail the check. A clean graph prints nothing.

1# Type checking
2
3`avril check` type-checks an entry module and its whole Avril module graph
4without executing any of it:
5
6```sh
7avril check --typescript=/absolute/path/to/package/lib/tsc main.ts
8```
9
10`--typescript=PATH` names the same pinned, unmodified native TypeScript
11backend as `avril lsp`; see the [download instructions](../lib/lsp/BACKEND.md).
12`--typescript PATH` is also accepted.
13
14Checking shares the language server's resolution and compiler settings
15rather than a generated `tsconfig.json`: `avril.conf` import maps and package
16ownership, `jsr:`/`npm:`/`https:` dependencies, `avril:` builtin declarations,
17per-file JSX settings, and the cache/lock/vendor policy selected by the usual
18package flags (`--offline`, `--frozen`, `--lock=PATH`, `--vendor=PATH`, …).
19The `types.imports` map can redirect module resolution for types only, and
20`types.globals` explicitly lists global declaration modules; neither changes
21runtime imports, nor are npm packages automatically added as globals merely
22because they are present. npm `@types` discovery is recorded during `add`,
23`cache`, `update`, and `vendor` (including negative results), then replayed from
24the lock by check and the language server. Use `avril cache main.ts` to prepare
25it first, or `--no-types-packages` to disable automatic DefinitelyTyped lookup
26without disabling bundled or explicitly configured declarations.
27See [npm type declarations](npm.md#type-declarations).
28Capability flags (`-0`, `--allow-*`, `--deny-*`) apply as they do for
29`avril cache`. As with the language server, checking may populate the package
30cache but never writes lockfiles, tsconfigs, or application sources.
31
32Diagnostics are printed one per line as
33`path:line:column: error TS2322: message`, using the original source
34locations. The command exits nonzero if any error is reported; warnings are
35printed but do not fail the check. A clean graph prints nothing.