-
Notifications
You must be signed in to change notification settings - Fork 12.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Design Meeting Notes, 3/24/2017 #14853
Comments
most importantly, speaking of promise like loading, the modules are more than objects, because the modules can contain types (unlike objects) while the promises are for objects only: #8358 |
@Aleksey-Bykov That's actually what was meant by "This would bring in the namespace import." Namespaces are containers of types and other namespaces. |
We actually bikeshedded for a while about whether one of the type import syntaxes should also be usable in a namespace position (e.g. a dotted name). |
@DanielRosenwasser need issue numbers here |
Thank-you TS team for revisiting the "Spread object literal freshness" issue, this has really made my day and it's super great to see such a responsive team. :) Cheers. |
Dynamic Import
Promise
of a module's namespace record.TypeScript-specific stuff
When given an explicit string, we can figure things out - otherwise, we need to be explicitly told the type somehow.
This means that when we run the pre-bind step, it needs to walk the full tree.
When people import "broken up" strings (i.e.
import(`hello/${thingHere}/index.js`)
can we provide a decent experience?Proposals to allow people to type untyped imports
import * as foo from "foo"
gets erased iffoo
is never used as a value.moduleof
keyword that takes a string literal.declare var m: import("./module")
declare var m: typeof import("./module")
declare var m: moduleof "./module";
declare var m: importof "./module";
declare var m: typeof "./module";
declare var m: module "./module";
Question: do these syntaxes allow qualified names?
*
declare var m: (module "./foo").namespace.Interface
We could adopt the
import type * as ns from "./a.js"
.* This would bring in the namespace import.
Conclusion: let's do the dynamic import, bikeshed offline.
Spread & rest type operators
spread(T, U)
andrest(T, 'a' | 'b' | 'c')
Concern: what about infinitely expansion & recursion problems.
Spread object literal freshness
When you spread in
c
, you don't know what properties it really has.So TypeScript doesn't really know if you have excess properties in some cases.
However,
d
very explicitly appears to be an excess property.It is statically known to be there - we can always tell.
There is agreement that we should catch that.
What about
Seems arguable about whether there should be an error.
Conclusion: track freshness on properties, not spreads.
The text was updated successfully, but these errors were encountered: