summaryrefslogtreecommitdiff
path: root/src/text/parse/core
diff options
context:
space:
mode:
authorrinsuki <428rinsuki+git@gmail.com>2018-06-17 19:55:39 +0900
committerrinsuki <428rinsuki+git@gmail.com>2018-06-17 19:55:39 +0900
commit8c40917cc2762a498cd2d35a4f4f69b01de3d672 (patch)
treeb2e32a07e1fb85964558428068f745a1c299118f /src/text/parse/core
parentbuild:ts success (diff)
downloadmisskey-8c40917cc2762a498cd2d35a4f4f69b01de3d672.tar.gz
misskey-8c40917cc2762a498cd2d35a4f4f69b01de3d672.tar.bz2
misskey-8c40917cc2762a498cd2d35a4f4f69b01de3d672.zip
[noImplicitAny: true] src/text
Diffstat (limited to 'src/text/parse/core')
-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;