Closed bobappleyard closed 10 years ago
Classic TypeScript problem here. A JavaScript function has taken advantage of dynamic typing and TypeScript can't represent it.
Parsing url normally
> require('url').parse('/?a=1') { ... query: "a=1", ... }
Parse it with query parsing switched on
> require('url').parse('/?a=1', true) { ... query: {a: '1'}, ... }
Parse it with multiple instances of an a parameter
> require('url').parse('/?a=1&a=2', true) { ... query: {a: ['1', '2']} ... }
I propose changing this field to any. It sucks but we can't do any better right now.
Maybe one day a sum type that can express this sort of thing will make its way into the language.
A pull request will be forthcoming.
Classic TypeScript problem here. A JavaScript function has taken advantage of dynamic typing and TypeScript can't represent it.
Parsing url normally
Parse it with query parsing switched on
Parse it with multiple instances of an a parameter
I propose changing this field to any. It sucks but we can't do any better right now.
Maybe one day a sum type that can express this sort of thing will make its way into the language.
A pull request will be forthcoming.