jonschlinkert/gray-matter

Invalid TypeScript type definition for `engines` option

caesar opened this issue · 2 comments

The TypeScript type definition is invalid due to missing types on the parameters for the engines callbacks.

When running TypeScript with the noImplicitAny option, the following error is emitted three times:
Parameter has a name but no type. Did you mean 'arg0: string'?

The incorrect definition is in the following lines (the two strings and the object are being interpreted as parameter names rather than types because no names are given).

engines?: {
[index: string]:
| ((string) => object)
| { parse: (string) => object; stringify?: (object) => string }
}

If I can work out what the syntax is for the engines callbacks I'll submit a PR.

Ah – I see there are already two open PRs identical to mine (dating back as far as April…).
My mistake; I checked for similar issues but not PRs.

See #74 and #77.

This has been fixed and released in 4.0.2.