Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bypass TS6133 error by allowing function declarations that are unused #323

Merged
merged 1 commit into from
Nov 29, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions builtin/postprocessors.ne
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
# Postprocessor generator that lets you select the nth element of the list.
# `id` is equivalent to nth(0).
@{%
// Bypasses TS6133. Allow declared but unused functions.
// @ts-ignore
function nth(n) {
return function(d) {
return d[n];
Expand All @@ -12,6 +14,8 @@ function nth(n) {

# Postprocessor generator that lets you generate an object dynamically.
@{%
// Bypasses TS6133. Allow declared but unused functions.
// @ts-ignore
function $(o) {
return function(d) {
var ret = {};
Expand Down
2 changes: 2 additions & 0 deletions lib/generate.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,8 @@
generate.ts = generate.typescript = function (parser, exportName) {
var output = "// Generated automatically by nearley, version " + parser.version + "\n";
output += "// http://github.com/Hardmath123/nearley\n";
output += "// Bypasses TS6133. Allow declared but unused functions.\n";
output += "// @ts-ignore\n";
output += "function id(d: any[]): any { return d[0]; }\n";
output += parser.customTokens.map(function (token) { return "declare var " + token + ": any;\n" }).join("")
output += parser.body.join('\n');
Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,6 @@
"microtime": "^2.1.2",
"mocha": "^2.5.3",
"moo": "^0.3.2",
"typescript": "^2.3.4"
"typescript": "^2.6.1"
}
}