Commit 44eac5b4 authored by Anthon Holmqvist's avatar Anthon Holmqvist
Browse files

fix(meta): add missing null return type to MetaTable.getMetaFor

parent aa068b2b
Pipeline #132864939 passed with stages
in 9 minutes and 32 seconds
......@@ -8,7 +8,7 @@ export type ProcessAttributeCallback = (
) => Iterable<AttributeData>;
export interface ProcessElementContext {
getMetaFor(tagName: string): MetaElement;
getMetaFor(tagName: string): MetaElement | null;
}
export type ProcessElementCallback = (
......
......@@ -158,7 +158,7 @@ export class MetaTable {
*
* @returns A shallow copy of metadata.
*/
public getMetaFor(tagName: string): MetaElement {
public getMetaFor(tagName: string): MetaElement | null {
tagName = tagName.toLowerCase();
return this.elements[tagName]
? Object.assign({}, this.elements[tagName])
......
......@@ -21,7 +21,7 @@ import {
WhitespaceEvent,
} from "../event";
import { Lexer, Token, TokenStream, TokenType } from "../lexer";
import { MetaTable } from "../meta";
import { MetaTable, MetaElement } from "../meta";
import { AttributeData } from "./attribute-data";
import { parseConditionalComment } from "./conditional-comment";
import { ParserError } from "./parser-error";
......@@ -294,7 +294,7 @@ export class Parser {
const processElement = source.hooks.processElement;
const metaTable = this.metaTable;
const context: ProcessElementContext = {
getMetaFor(tagName: string) {
getMetaFor(tagName: string): MetaElement | null {
return metaTable.getMetaFor(tagName);
},
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment