summaryrefslogtreecommitdiff
path: root/src/text/parse/core/syntax-highlighter.ts
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2018-06-18 08:42:17 +0900
committerGitHub <noreply@github.com>2018-06-18 08:42:17 +0900
commita766faeae9f5d5ea9be6f758ec446dbcd240a86e (patch)
treee2ed5f30e2776259ef961c9f9a82412e7f9f66cd /src/text/parse/core/syntax-highlighter.ts
parentMerge pull request #1735 from rinsuki/fix/minor-fix-201806171721 (diff)
parent[noImplicitAny: true] src/services/drive (diff)
downloadmisskey-a766faeae9f5d5ea9be6f758ec446dbcd240a86e.tar.gz
misskey-a766faeae9f5d5ea9be6f758ec446dbcd240a86e.tar.bz2
misskey-a766faeae9f5d5ea9be6f758ec446dbcd240a86e.zip
Merge pull request #1738 from rinsuki/features/ts-noimplicitany-true
[WIP] noImplicitAny: true
Diffstat (limited to 'src/text/parse/core/syntax-highlighter.ts')
-rw-r--r--src/text/parse/core/syntax-highlighter.ts13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/text/parse/core/syntax-highlighter.ts b/src/text/parse/core/syntax-highlighter.ts
index c0396b1fc6..3fb7a3b73d 100644
--- a/src/text/parse/core/syntax-highlighter.ts
+++ b/src/text/parse/core/syntax-highlighter.ts
@@ -1,4 +1,4 @@
-function escape(text) {
+function escape(text: string) {
return text
.replace(/>/g, '&gt;')
.replace(/</g, '&lt;');
@@ -110,7 +110,14 @@ const symbols = [
'?'
];
-const elements = [
+type Token = {
+ html: string
+ next: number
+};
+
+type Element = (code: string, i: number, source: string) => (Token | null);
+
+const elements: Element[] = [
// comment
code => {
if (code.substr(0, 2) != '//') return null;
@@ -305,7 +312,7 @@ export default (source: string, lang?: string) => {
let i = 0;
- function push(token) {
+ function push(token: Token) {
html += token.html;
code = code.substr(token.next);
i += token.next;