mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
28 lines
611 B
TypeScript
28 lines
611 B
TypeScript
//// [tests/cases/compiler/errorElaborationDivesIntoApparentlyPresentPropsOnly.ts] ////
|
|
|
|
//// [errorElaborationDivesIntoApparentlyPresentPropsOnly.ts]
|
|
function foo<T extends { a: string }>(x: T) {
|
|
x = { a: "abc", b: 20, c: 30 };
|
|
}
|
|
|
|
function bar<T extends { a: string }>(x: T) {
|
|
x = { a: 20 };
|
|
}
|
|
|
|
function baz<T extends { a: string }>(x: T) {
|
|
x = { a: "not ok" };
|
|
}
|
|
|
|
|
|
//// [errorElaborationDivesIntoApparentlyPresentPropsOnly.js]
|
|
"use strict";
|
|
function foo(x) {
|
|
x = { a: "abc", b: 20, c: 30 };
|
|
}
|
|
function bar(x) {
|
|
x = { a: 20 };
|
|
}
|
|
function baz(x) {
|
|
x = { a: "not ok" };
|
|
}
|