diff --git a/uni_modules/uts-tests/utssdk/JSON.uts b/uni_modules/uts-tests/utssdk/JSON.uts index 1b1e3481d1a6a4beff653424ac54b42acdf10a93..4bdd1d4cf51929a6529c4eae4fca1fb46f4ce052 100644 --- a/uni_modules/uts-tests/utssdk/JSON.uts +++ b/uni_modules/uts-tests/utssdk/JSON.uts @@ -404,5 +404,16 @@ export function testJSON() : Result { expect(map?.get('a')?.num).toEqual(1) }) + test('parse generic type', () => { + type A = { + num: number, + } + function test(json: string): T { + return JSON.parse(json)! + } + const a = test(`{"num": 1}`) + expect(a.num).toEqual(1) + }) + }) } \ No newline at end of file