mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
21 lines
573 B
TypeScript
21 lines
573 B
TypeScript
import stringify = require('fast-json-stable-stringify');
|
|
|
|
const obj = { c: 8, b: [{ z: 6, y: 5, x: 4 }, 7], a: 3 };
|
|
|
|
stringify(obj); // $ExpectType string
|
|
// $ExpectType string
|
|
stringify(obj, (a, b) => {
|
|
a; // $ExpectType CompareDescriptor
|
|
b; // $ExpectType CompareDescriptor
|
|
return a.key < b.key ? 1 : -1;
|
|
});
|
|
// $ExpectType string
|
|
stringify(obj, {
|
|
cmp(a, b) {
|
|
a; // $ExpectType CompareDescriptor
|
|
b; // $ExpectType CompareDescriptor
|
|
return a.key < b.key ? 1 : -1;
|
|
},
|
|
});
|
|
stringify(obj, { cycles: true }); // $ExpectType string
|