Merge pull request #4658 from JoshuaKGoldberg/master

Add d.ts for js-beautify
This commit is contained in:
Horiuchi_H
2015-06-17 22:35:14 +09:00
2 changed files with 57 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
/// <reference path="js-beautify.d.ts" />
var simple: string = js_beautify("console.log('Hello world!');");
var full: string = js_beautify(
"console.log('Hello world!');",
{
"indent_size": 4,
"indent_char": " ",
"eol": "\n",
"indent_level": 0,
"indent_with_tabs": false,
"preserve_newlines": true,
"max_preserve_newlines": 10,
"jslint_happy": false,
"space_after_anon_function": false,
"brace_style": "collapse",
"keep_array_indentation": false,
"keep_function_indentation": false,
"space_before_conditional": true,
"break_chained_methods": false,
"eval_code": false,
"unescape_strings": false,
"wrap_line_length": 0,
"wrap_attributes": "auto",
"wrap_attributes_indent_size": 4,
"end_with_newline": false
});

29
js-beautify/js-beautify.d.ts vendored Normal file
View File

@@ -0,0 +1,29 @@
// Type definitions for js_beautify
// Project: https://github.com/beautify-web/js-beautify/
// Definitions by: Josh Goldberg <https://github.com/JoshuaKGoldberg/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare var js_beautify: {
(js_source_text: string, options?: {
indent_size?: number;
indent_char?: string;
eol?: string;
indent_level?: number;
indent_width_tabs?: boolean;
preserve_newlines?: boolean;
max_preserve_newlines?: number;
jslint_happy: boolean;
space_after_anon_function: boolean;
brace_style: string;
keep_array_indentation: boolean;
keep_function_indentation: boolean;
space_before_conditional: boolean;
break_chained_methods: boolean;
eval_code: boolean;
unescape_strings: boolean;
wrap_line_length: number;
wrap_attributes: string;
wrap_attributes_indent_size: number;
end_with_newline: boolean;
}): string;
};