jespertheend / deno-tsc-helper Goto Github PK
View Code? Open in Web Editor NEWAllows type checking of code meant for Deno with tsc.
Home Page: https://deno.land/x/deno_tsc_helper
Allows type checking of code meant for Deno with tsc.
Home Page: https://deno.land/x/deno_tsc_helper
If mod.js is run directly it should function as a cli with the same available arguments as for generateTypes()
For example, https://unpkg.com/browse/@types/[email protected]/ has a ton of .d.ts files. Adding index.d.ts
alone isn't enough.
The deno types
command is being run every time you run the script
Js files are likely to contain errors, especially if the user has checkJs: true
. We can ignore all errors in vendored files by adding
// @ts-nocheck
at the top of each file.
https://esm.sh/[email protected]?pin=v87 for example gets vendored as a .js file.
deno vendor
seems to add a comment to the top of files which we can use for this:
// @deno-types="https://esm.sh/v87/[email protected]/lib/typescript.d.ts"
For some applications running the script can take a long time.
logging more messages shows that the script is working and can help with debugging issues.
It prints the url that was used for the vendor command, but it would be useful to also print the import specifier and the file that imported it.
deno vendor
uses the cache, but we might want to handle the extraTypeRoots
downloads gracefully.
That way in case the user is offline, the other types can still be downloaded.
Also I think .d.ts files from the vendored @deno-types
comments are not downloaded. But no error is thrown, so when running a second time, this step is skipped because it's already been added to the cache file
If the script fails, the vendored files and tsconfig.json might contain corrupt data.
Better remove the cache file so subsequent runs are forced to start with a fresh cache
Deno.emit()
has ben deprecated.
If two separate files contain the same import specifier, the vendor command is run twice
For example:
import "https://deno.land/x/[email protected]/mod.js"
$chdir_anywhere
to deno.land/xBecause the cachefile already contains an entry for the url, nothing is updated.
For instance, adding "npm:[email protected]"
is supposed to create an ambient module but you have to delete your cachefile for it to be generated.
Currently whenever a new module is detected that isn't listed in the cache file, all modules are vendored.
Instead it might be possible to run the vendor command for the new modules only.
Currently importing https://deno.land/x/[email protected]/generateTypes.js
itself is still causing issues because it is not getting added to the tsconfig paths.
Create a file that stores a hash based on the contents of certain files, and only run if the hash changed.
A readme could be useful to users unfamiliar with projects. The readme explain that the files are generated and what they are for.
There are a few type errors in mod.js caused by import ts from "https://esm.sh/[email protected]?pin=v87";
not having types.
Deno resolves files by their real path, but tsc doesn't allow .ts
imports.
Until microsoft/TypeScript#37582 is fixed we'll just replace all the import statements to fix this.
In getIncludeExcludeFiles()
the filter checks if exclude.includes(entry.name)
but entry.name
is the name of the file/directory, not a path.
As a result, the exclude
option is rather useless.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.