Comments (3)
I don't think there is a bug here. Spreading an undefined
value creates no properties, so { ...t }
produces {}
when t
is undefined
. Thus, the result is T | {}
, which reduces to just {}
by subtype reduction.
from typescript.
I'm confused a little on the situation of foo
. I think it is also because of subtype reduction which the type of { ...t, foo: number }
is { foo: number }
. But as we see it was (T & { foo: number }) | { foo: number }
in some old versions of TS, did there happen some "breaking changes" on subtype reduction?
from typescript.
This issue has been marked as "Working as Intended" and has seen no recent activity. It has been automatically closed for house-keeping purposes.
from typescript.
Related Issues (20)
- Adding "WebWorker" to the `lib` compiler options causes compilation to fail? HOT 1
- Some of the semantic diagnostics use fileName and not relative file name as part of semantic diagnostics and it makes tsbuildinfo unportable
- Add support for nixos for easily on-boarding developers onto the project. HOT 1
- Clarify logging for "No Project" when hitting memory limit
- æłćç±»ćèȘćšæšćéèŻŻ HOT 1
- Typescript allows assignment of wrong type to property on union type HOT 10
- Wrong inferred initial value in reduce HOT 2
- Type guard does not work with `Readonly` props HOT 1
- Allow --build with Intermediate Errors - shouldn't happen on tsconfig errors HOT 3
- Constraints of nested conditional types applied to constrained type variables are incorrect
- Inferred project that currently use "current directory of tsserver host" needs some special handling
- Unable to use rest on generic that has been narrowed to an object HOT 5
- Error out if using node builtin modules and global variables in browser environment HOT 2
- False positive for "Unreachable code detected" for code following `switch`/`case` with `allowUnreachableCode: false` HOT 3
- "const" was transformed to "var" when target is "esnext" HOT 3
- Understanding type checker cache HOT 5
- Allow `.js` file generated from `.tsx` file to be runnable in browser with less configuration HOT 5
- TS7022 (implicity 'any' type) popping up in a random scenario HOT 10
- Add `preparePaste` method to check if copied text should potentially have smart paste enabled or not HOT 1
- Organize Imports feature sort order disagrees with eslint import/order HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
đ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. đđđ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google â€ïž Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from typescript.