Revert "Remove Flow annotations and pragmas"

This reverts commit 4252244d06.
This commit is contained in:
Amjad Masad
2016-03-03 15:03:55 -08:00
parent 3667527d04
commit 12ee11a0a4
49 changed files with 444 additions and 287 deletions

View File

@@ -1,3 +1,4 @@
/* @flow */
/* eslint indent: 0 */
/* eslint max-len: 0 */
@@ -61,7 +62,7 @@ function getTokenType(match) {
* Highlight `text`.
*/
function highlight(text) {
function highlight(text: string) {
return text.replace(jsTokens, function (...args) {
let type = getTokenType(args);
let colorize = defs[type];
@@ -77,7 +78,12 @@ function highlight(text) {
* Create a code frame, adding line numbers, code highlighting, and pointing to a given position.
*/
export default function (rawLines, lineNumber, colNumber, opts = {}) {
export default function (
rawLines: string,
lineNumber: number,
colNumber: number,
opts: Object = {},
): string {
colNumber = Math.max(colNumber, 0);
let highlighted = opts.highlightCode && chalk.supportsColor;