Deno: option to import default .ts file

Created on 10 May 2019  路  4Comments  路  Source: denoland/deno

Hello, I remember one of the old version support import .ts file by default, so import statement doesn't have to specify the full file name.

can you please add that option back? and give a flag or something to control this behavior

thanks!

Most helpful comment

@lab4quant Yeah, we are aware that this hinders adoption. At the moment we're not optimizing for adoption - we're trying to get the design of the core system correct. So the safest thing for us to do (to avoid making irreversible mistakes) is to stick to the spirit of the ES standards as closely as possible: I don't think they would introduce URLs which do not resolve to actual files.

It may be in the future we will switch focus to adaption and attempt to fix this somehow. But not now.

Thanks for raising the issue tho - it's good to hear the feedback.

All 4 comments

What do you mean by "default"?

Deno will always require imports include their file extension (if the file has a file extension).

Correct, it is an explicit design decision. Having magic extension resolution causes lots of issues, ones the community is still suffering today. We should be explicit about the resources we are loading.

sorry, I already have a library developed using typescript, I use vscode's tool to import ts files,
the import lines generated automatically vscode does not have '.ts' file extension.

so to use deno with my lib, i have to manually add '.ts' to all those import lines, which is a lot.

@lab4quant Yeah, we are aware that this hinders adoption. At the moment we're not optimizing for adoption - we're trying to get the design of the core system correct. So the safest thing for us to do (to avoid making irreversible mistakes) is to stick to the spirit of the ES standards as closely as possible: I don't think they would introduce URLs which do not resolve to actual files.

It may be in the future we will switch focus to adaption and attempt to fix this somehow. But not now.

Thanks for raising the issue tho - it's good to hear the feedback.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

benjamingr picture benjamingr  路  3Comments

davidbarratt picture davidbarratt  路  3Comments

ry picture ry  路  3Comments

ry picture ry  路  3Comments

kitsonk picture kitsonk  路  3Comments