4 ms·
I get the appeal of TS, but why the fuck would any project tie themselves to the language in this way? Angular 2+ did it, I didn't realize Deno did as well. Ver
by danielvaughn 5y ago
I get the appeal of TS, but why the fuck would any project tie themselves to the language in this way? Angular 2+ did it, I didn't realize Deno did as well. Very bizarre decision unless I'm missing something.
- xkapastel 5y agoWhat do you mean? You can use TypeScript or JavaScript, so .ts or .js extensions. I think what you are missing is that, if you use TypeScript in Deno, the extension is .ts. What's confusing is the way Node.js+TypeScript does it, which means using TypeScript with .js extensions.
- danielvaughn 5y agoOhh I see. I should probably delete my comment then. I thought the OP meant that Deno enforces the use of Typescript like Angular does. That makes a lot more sense, thanks for the explanation.
- spankalee 5y agoThe way TypeScript/Node does it is correct. The thing you're importing is JS with a .js extension. If you publish to npm you're publishing the JS files, not TS files. If you write .d.ts/.js pairs instead of .ts - which should be identical to importers, there's no .ts file to import.
- nllsh 5y agoConsidering that Ryan Dahl started both Node.js (where imports do not include file extensions) and Deno (where he added them back after deciding it was a bad decision to leave them off) I'm not sure how you've come to the conclusion that TypeScript/Node does importing correctly. Additionally, the ecmascript import syntax https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe... specifically mentions that your tooling may or may not need file extensions but the examples in the spec (and indeed in browsers at large) require a full or relative path including the extension. If anything, I'd bet that file extensions make it into Node and tsc in the next few years.
- spankalee 5y agoNode requires the extension for imports already, unless the package you're importing from has defined extensionless entries in an export map.
- xkapastel 5y agoI don't see how it is correct. If you publish to npm, of course you do it the way Node does it, but that's not very interesting. If you publish a module for consumption by Deno, you're publishing TS files, not JS files, and there is no need for .d.ts files.
- Bilal_io 5y agoJust like the sibling comment stated. Angular does not force you to use Typescript, you can use JavaScript. Angular 2+ even used to work with Dart but they dropped it.
- ignoramous 5y ago> Angular 2+ even used to work with Dart but they dropped it. "They" dropped Angular altogether: https://blog.angular.io/finding-a-path-forward-with-angularjs-7e186fdd4429 https://blog.angular.io/finding-a-path-forward-with-angularj...
- Bilal_io 5y agoI was not referring to Angularjs. I specifically mentioned Angular 2+.
- ignoramous 5y agoMy bad. Didn't know there was a "fork"... Thanks.
- chaosharmonic 5y agoDeno uses SWC under the hood, so a large chunk of its TypeScript support is already coming from upstream.