From ca85be9696cde54d6bb92641a3374f6acc092bf4 Mon Sep 17 00:00:00 2001 From: Ziv Date: Tue, 11 May 2021 14:20:07 +0800 Subject: [PATCH] build: add the basic type declaration (#30) --- package.json | 2 ++ src/parser/flinksql.ts | 2 +- src/parser/generic.ts | 2 +- src/parser/hive.ts | 2 +- src/parser/plsql.ts | 2 +- src/parser/spark.ts | 2 +- tsconfig.json | 1 + 7 files changed, 8 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index c42c780..6e26769 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,8 @@ "bigdata" ], "main": "dist/index.js", + "module": "dist/index.js", + "types": "dist/index.d.ts", "scripts": { "antlr4": "node build/antlr4.js", "build": "rm -rf dist && tsc", diff --git a/src/parser/flinksql.ts b/src/parser/flinksql.ts index 22e50a8..2cc3fc6 100644 --- a/src/parser/flinksql.ts +++ b/src/parser/flinksql.ts @@ -9,7 +9,7 @@ export default class FlinkSQL extends BasicParser { const lexer = new FlinkSqlLexer(chars) as Lexer; return lexer; } - public createParserFromLexer(lexer: Lexer) { + public createParserFromLexer(lexer: Lexer): any { const tokenStream = new CommonTokenStream(lexer); return new FlinkSqlParser(tokenStream); } diff --git a/src/parser/generic.ts b/src/parser/generic.ts index 4a4e8e3..d06e5e7 100644 --- a/src/parser/generic.ts +++ b/src/parser/generic.ts @@ -9,7 +9,7 @@ export default class GenericSQL extends BasicParser { const lexer = new SqlLexer(chars) as Lexer; return lexer; } - public createParserFromLexer(lexer: Lexer) { + public createParserFromLexer(lexer: Lexer): any { const tokenStream = new CommonTokenStream(lexer); return new SqlParser(tokenStream); } diff --git a/src/parser/hive.ts b/src/parser/hive.ts index 6855f23..1e5b5ed 100644 --- a/src/parser/hive.ts +++ b/src/parser/hive.ts @@ -9,7 +9,7 @@ export default class HiveSQL extends BasicParser { const lexer = new HiveSqlLexer(chars) as Lexer; return lexer; } - public createParserFromLexer(lexer: Lexer) { + public createParserFromLexer(lexer: Lexer): any { const tokenStream = new CommonTokenStream(lexer); return new HiveSql(tokenStream); } diff --git a/src/parser/plsql.ts b/src/parser/plsql.ts index c88e350..54a75e6 100644 --- a/src/parser/plsql.ts +++ b/src/parser/plsql.ts @@ -10,7 +10,7 @@ export default class PLSQLParser extends BasicParser { const lexer = new PlSqlLexer(chars) as Lexer; return lexer; } - public createParserFromLexer(lexer: Lexer) { + public createParserFromLexer(lexer: Lexer): any { const tokenStream = new CommonTokenStream(lexer); return new PlSqlParser(tokenStream); } diff --git a/src/parser/spark.ts b/src/parser/spark.ts index 9e511e4..294a62f 100644 --- a/src/parser/spark.ts +++ b/src/parser/spark.ts @@ -9,7 +9,7 @@ export default class SparkSQL extends BasicParser { const lexer = new SparkSqlLexer(chars) as Lexer; return lexer; } - public createParserFromLexer(lexer: Lexer) { + public createParserFromLexer(lexer: Lexer): any { const tokenStream = new CommonTokenStream(lexer); return new SparkSqlParser(tokenStream); } diff --git a/tsconfig.json b/tsconfig.json index d2e575d..f42337b 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -5,6 +5,7 @@ "allowJs":true, "target": "es6", "module": "commonjs", + "declaration": true, "noUnusedLocals": true, "noUnusedParameters": false, "skipLibCheck": true,