mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-03 22:37:03 +00:00
new typedef
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
import * as antlr4 from 'antlr4';
|
||||
import * as autosuggest from 'antlr4-autosuggest';
|
||||
|
||||
class Antlr4JSLexer extends antlr4.Lexer {
|
||||
constructor(chars: antlr4.InputStream) {
|
||||
super();
|
||||
}
|
||||
}
|
||||
|
||||
class Antlr4JSParser extends antlr4.Parser {
|
||||
constructor(tokens: antlr4.CommonTokenStream) {
|
||||
super(tokens);
|
||||
}
|
||||
}
|
||||
|
||||
const autosuggester: autosuggest.AutoSuggester = autosuggest.autosuggester(Antlr4JSLexer, Antlr4JSParser);
|
||||
const suggestions: string[] = autosuggester.autosuggest('ABC');
|
||||
|
||||
const lowercase = autosuggest.autosuggester(Antlr4JSLexer, Antlr4JSParser, 'LOWER');
|
||||
Vendored
+18
@@ -0,0 +1,18 @@
|
||||
// Type definitions for antlr4-autosuggest 0.0
|
||||
// Project: https://github.com/oranoran/antlr4-autosuggest-js
|
||||
// Definitions by: Jon Freedman <https://github.com/jonfreedman>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import * as antlr4 from 'antlr4';
|
||||
|
||||
export type CasePreference = 'LOWER' | 'UPPER' | 'BOTH';
|
||||
|
||||
export interface AutoSuggester {
|
||||
autosuggest: (inputText: string) => string[];
|
||||
}
|
||||
|
||||
export interface Constructor<T> {
|
||||
new (...args: any[]): T;
|
||||
}
|
||||
|
||||
export function autosuggester<Lexer extends antlr4.Lexer, Parser extends antlr4.Parser>(lexerCtr: Constructor<Lexer>, parserCtr: Constructor<Parser>, casePref?: CasePreference | null): AutoSuggester;
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"antlr4-autosuggest-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user