Skip to content
Snippets Groups Projects
Commit 33432fa8 authored by syuilo's avatar syuilo Committed by marihachi
Browse files

refactor: rename getNodeByType --> NodeType

parent 2b86b9b9
No related branches found
No related tags found
No related merge requests found
...@@ -56,7 +56,7 @@ export function extract(nodes: MfmNode[], type: (MfmNode['type'] | MfmNode['type ...@@ -56,7 +56,7 @@ export function extract(nodes: MfmNode[], type: (MfmNode['type'] | MfmNode['type
return dest; return dest;
} }
export { getNodeByType } from './node'; export { NodeType } from './node';
export { export {
MfmNode, MfmNode,
......
...@@ -158,7 +158,7 @@ export type MfmText = { ...@@ -158,7 +158,7 @@ export type MfmText = {
children?: []; children?: [];
}; };
export type getNodeByType<T extends MfmNode['type']> = export type NodeType<T extends MfmNode['type']> =
T extends 'quote' ? MfmQuote : T extends 'quote' ? MfmQuote :
T extends 'search' ? MfmSearch : T extends 'search' ? MfmSearch :
T extends 'blockCode' ? MfmCodeBlock : T extends 'blockCode' ? MfmCodeBlock :
......
...@@ -4,11 +4,11 @@ ...@@ -4,11 +4,11 @@
*/ */
import { expectType } from 'tsd'; import { expectType } from 'tsd';
import { getNodeByType, MfmUrl } from '../built'; import { NodeType, MfmUrl } from '../built';
describe('#getNodeByType', () => { describe('#NodeType', () => {
it('returns node that has sprcified type', () => { it('returns node that has sprcified type', () => {
const x = null as unknown as getNodeByType<'url'>; const x = null as unknown as NodeType<'url'>;
expectType<MfmUrl>(x); expectType<MfmUrl>(x);
}); });
}); });
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment