提交 0ef0688a 编写于 作者: 雪洛's avatar 雪洛

test: 增加JSON.parse传入Map的测试例

上级 960622e7
...@@ -321,5 +321,14 @@ export function testJSON() : Result { ...@@ -321,5 +321,14 @@ export function testJSON() : Result {
expect(map.get('a')).toEqual(1) expect(map.get('a')).toEqual(1)
}) })
test('parse Map', () => {
type A = {
num: number,
}
const map = JSON.parse<Map<string, A>>(`{"a": {"num": 1}}`)
expect(map instanceof Map).toEqual(true)
expect(map?.get('a')?.num).toEqual(1)
})
}) })
} }
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册