"Import" was already decided to help the parser performing static analysis versus "require". Now "mjs" is introduced to make detecting if we are in front of a commonjs or module "faster". I'm sure the people who decided this are very bright, but the main goal was how to be nice with v8, and not how to be easy for developers.
Changing from js to ts is an inconvenience sufficiently big enough to adopt flowtype instead.
> I read that a lot. Why do people don't like the new extensions?
Probably because you'll end up with .mts, .mjsx, .mts, .mtsx.
So? If they are different types, it makes sense to have different extensions (e.g. if mts implies typescript module).
> mts implies typescript module
Or mpeg transport stream:
Well, they can coordinate that like we coordinate mime types.
I've chanced upon the "same extension for the same thing" as a problem maybe 2-3 times in 30+ years.
Re:Node v8.5.0
by kdkdkdk333ke on Wednesday September 13, 2017 @09:43AM
(#15238130)
They usually use .ts extension, or .tsv, .tsa according to the wiki article you just linked.
.mts is unheard of.
Ive seen it in the wild. May not be that common though.
my camera (Lumix GH2) produces MTS files
Re:Node v8.5.0
by bradstewart on Wednesday September 13, 2017 @10:30AM
(#15238606)
I like that better than having to open a file and read its source to figure out what type of module it exports...
I read that a lot. Why do people don't like the new extensions?
Seems like the most elegant and programmatically more performant and less hassle free, solution to the issue.
Everything else looks like a terrible kludge.