From c140f1c706afd9e1ed1f6b9476941330c04f19cd Mon Sep 17 00:00:00 2001 From: duqingquan Date: Mon, 22 Jul 2024 12:36:52 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20Object.assign=20=E5=B8=A6?= =?UTF-8?q?=E6=B3=9B=E5=9E=8B=E7=9A=84=E6=B5=8B=E8=AF=95=E7=A4=BA=E4=BE=8B?= =?UTF-8?q?=E8=AF=AD=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- uni_modules/uts-tests/utssdk/UTSJSONObject.uts | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/uni_modules/uts-tests/utssdk/UTSJSONObject.uts b/uni_modules/uts-tests/utssdk/UTSJSONObject.uts index 4533cda..92f4468 100644 --- a/uni_modules/uts-tests/utssdk/UTSJSONObject.uts +++ b/uni_modules/uts-tests/utssdk/UTSJSONObject.uts @@ -22,13 +22,21 @@ export function testUTSJSONObject() : Result { expect(returnedTarget.toMap().size).toEqual(3); type A = { - username:"张三", - age:12 + username:string + age:number } type C = { - work:0.001 + work:number } - let b = UTSJSONObject.assign(new A("张三",12),{b:2},new C(0.002)) + + let b = UTSJSONObject.assign( { + username:"张三", + age:12 + } as A, + {b:2}, + { + work:0.002 + } as C) expect(b['age']).toEqual(12); expect(b['username']).toEqual("张三"); expect(b['b']).toEqual(2); -- GitLab