mirror of
https://activitypub.software/TransFem-org/sfm-js
synced 2024-11-21 13:45:10 +00:00
refactor: rename getNodeByType --> NodeType
This commit is contained in:
parent
2b86b9b9b7
commit
33432fa857
3 changed files with 5 additions and 5 deletions
|
@ -56,7 +56,7 @@ export function extract(nodes: MfmNode[], type: (MfmNode['type'] | MfmNode['type
|
|||
return dest;
|
||||
}
|
||||
|
||||
export { getNodeByType } from './node';
|
||||
export { NodeType } from './node';
|
||||
|
||||
export {
|
||||
MfmNode,
|
||||
|
|
|
@ -158,7 +158,7 @@ export type MfmText = {
|
|||
children?: [];
|
||||
};
|
||||
|
||||
export type getNodeByType<T extends MfmNode['type']> =
|
||||
export type NodeType<T extends MfmNode['type']> =
|
||||
T extends 'quote' ? MfmQuote :
|
||||
T extends 'search' ? MfmSearch :
|
||||
T extends 'blockCode' ? MfmCodeBlock :
|
||||
|
|
|
@ -4,11 +4,11 @@
|
|||
*/
|
||||
|
||||
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', () => {
|
||||
const x = null as unknown as getNodeByType<'url'>;
|
||||
const x = null as unknown as NodeType<'url'>;
|
||||
expectType<MfmUrl>(x);
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue