We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
google stackoverflow https://github.com/Microsoft/TypeScript/wiki/FAQ#what-is-structural-typing
This is the behavior in every version I tried, and I reviewed all the FAQ for entries
[[<!-- A link to a TypeScript Playground "Share" link which shows this behavior
The TypeScript Workbench can be used for more complex setups, try https://www.typescriptlang.org/dev/bug-workbench/
As a last resort, you can link to a repo, but these will be slower for us to investigate. --> Playground link with relevant code](https://www.typescriptlang.org/play?noUncheckedIndexedAccess=true&target=99&noImplicitOverride=false#code/JYOwLgpgTgZghgYwgAgLIE8AqEDOYCS4E8SyA3gFDLXJwD8AXMnlKAObIA+yIArgDb8A3FRoAjRszCsQHbn0EiAvhQoQAHgAcA9lDDIYvEAjDBtIZAFssuMADEjJsyAAUFAJRMM2PIUgkUShpkBHM8ZDE4HAgvG18iAOQAXnJRYOo4JgByAEYsgBo09LFsgCYCoqURItCQcLgoKGTkAG1kXIL28uQAXWrgqAgwXigLIPTqADppyOjCianphqhKiiUgA)](https://www.typescriptlang.org/play?noUncheckedIndexedAccess=true&target=99&noImplicitOverride=false#code/JYOwLgpgTgZghgYwgAgLIE8AqEDOYCS4E8SyA3gFDLXJwD8AXMnlKAObIA+yIArgDb8A3FRoAjRszCsQHbn0EiAvhQoQAHgAcA9lDDIYvEAjDBtIZAFssuMADEjJsyAAUFAJRMM2PIUgkUShpkBHM8ZDE4HAgvG18iAOQAXnJRYOo4JgByAEYsgBo09LFsgCYCoqURItCQcLgoKGTkAG1kXIL28uQAXWrgqAgwXigLIPTqADppyOjCianphqhKiiUgA)
interface MyTestInteface { a?: string | null; b?: string | null; } export function myTestFunction( ): MyTestInteface { const base: MyTestInteface = { a: '1', b: '2', }; const arr = [ '1', '2' ]; return { ...base, ...arr } }
No typescript error in return statement
Array is destructuring in object, that should be MyTestInteface. Expecting an error here
The text was updated successfully, but these errors were encountered:
Duplicate of #49667 / #9726.
And the syntax you're using is called "spreading", not destructuring.
Sorry, something went wrong.
This issue has been marked as a 'Duplicate' and has seen no recent activity. It has been automatically closed for house-keeping purposes.
No branches or pull requests
Bug Report
🔎 Search Terms
google
stackoverflow
https://github.com/Microsoft/TypeScript/wiki/FAQ#what-is-structural-typing
🕗 Version & Regression Information
This is the behavior in every version I tried, and I reviewed all the FAQ for entries
⏯ Playground Link
[[<!--
A link to a TypeScript Playground "Share" link which shows this behavior
The TypeScript Workbench can be used for more complex setups, try
https://www.typescriptlang.org/dev/bug-workbench/
As a last resort, you can link to a repo, but these will be slower for us to investigate.
-->
Playground link with relevant code](https://www.typescriptlang.org/play?noUncheckedIndexedAccess=true&target=99&noImplicitOverride=false#code/JYOwLgpgTgZghgYwgAgLIE8AqEDOYCS4E8SyA3gFDLXJwD8AXMnlKAObIA+yIArgDb8A3FRoAjRszCsQHbn0EiAvhQoQAHgAcA9lDDIYvEAjDBtIZAFssuMADEjJsyAAUFAJRMM2PIUgkUShpkBHM8ZDE4HAgvG18iAOQAXnJRYOo4JgByAEYsgBo09LFsgCYCoqURItCQcLgoKGTkAG1kXIL28uQAXWrgqAgwXigLIPTqADppyOjCianphqhKiiUgA)](https://www.typescriptlang.org/play?noUncheckedIndexedAccess=true&target=99&noImplicitOverride=false#code/JYOwLgpgTgZghgYwgAgLIE8AqEDOYCS4E8SyA3gFDLXJwD8AXMnlKAObIA+yIArgDb8A3FRoAjRszCsQHbn0EiAvhQoQAHgAcA9lDDIYvEAjDBtIZAFssuMADEjJsyAAUFAJRMM2PIUgkUShpkBHM8ZDE4HAgvG18iAOQAXnJRYOo4JgByAEYsgBo09LFsgCYCoqURItCQcLgoKGTkAG1kXIL28uQAXWrgqAgwXigLIPTqADppyOjCianphqhKiiUgA)
💻 Code
🙁 Actual behavior
No typescript error in return statement
🙂 Expected behavior
Array is destructuring in object, that should be MyTestInteface. Expecting an error here
The text was updated successfully, but these errors were encountered: