You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
writing type safe javascript module, with version string abstracted away to manage versions easily
constpreact="preact@10.24.3"const{ h, render }=awaitimport(`https://esm.sh/${preact}`)const{ computed, effect, signal }=awaitimport(`https://esm.sh/@preact/signals@1.3.0?deps=${preact}`)console.log(`preact version is ${preact}`)
What shortcomings exist with current approaches?
What workarounds are you using in the meantime?
due to type check not working in above example, version string has to be duplicated, which might cause bug when naively regex-replacing.
import{h,render}from"https://esm.sh/preact@10.24.3"import{computed,effect,signal}from"https://esm.sh/@preact/signals@1.3.0?deps=preact@10.24.3"console.log("preact version is preact@10.24.3")
The text was updated successfully, but these errors were encountered:
π Search Terms
dynamic import constant string infer type any
β Viability Checklist
β Suggestion
statically analyze type of dynamic import if path is statically analyzable, such that
as type of
polars
is"nodejs-polars"
, notstring
, typescript should treatimport("nodejs-polars")
the same asimport(polars)
.π Motivating Example
denoland/deno#26965
Playground Link
π» Use Cases
writing type safe javascript module, with version string abstracted away to manage versions easily
due to type check not working in above example, version string has to be duplicated, which might cause bug when naively regex-replacing.
The text was updated successfully, but these errors were encountered: