Skip to content

Commit

Permalink
added more specific types
Browse files Browse the repository at this point in the history
  • Loading branch information
jannikac committed Jul 8, 2024
1 parent fb61486 commit 6273d65
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 5 deletions.
23 changes: 21 additions & 2 deletions lib/ical/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,24 @@ import Timezone from "./timezone.js";
import ICALParse from "./parse.js";
import stringify from "./stringify.js";
import design from "./design.js";
// needed for typescript type resolution
// eslint-disable-next-line no-unused-vars
import Duration from "./duration.js";
// needed for typescript type resolution
// eslint-disable-next-line no-unused-vars
import UtcOffset from "./utc_offset.js";
// needed for typescript type resolution
// eslint-disable-next-line no-unused-vars
import Binary from "./binary.js";
// needed for typescript type resolution
// eslint-disable-next-line no-unused-vars
import Period from "./period.js";
// needed for typescript type resolution
// eslint-disable-next-line no-unused-vars
import Recur from "./recur.js";
// needed for typescript type resolution
// eslint-disable-next-line no-unused-vars
import Time from "./time.js";

/**
* This lets typescript resolve our custom types in the
Expand Down Expand Up @@ -277,8 +295,9 @@ class Component {
/**
* Returns first property's value, if available.
*
* @param {String=} name Lowercase property name
* @return {?Object} The found property value.
* @param {String=} name Lowercase property name
* @return {Binary | Duration | Period |
* Recur | Time | UtcOffset | null} The found property value.
*/
getFirstPropertyValue(name) {
let prop = this.getFirstProperty(name);
Expand Down
26 changes: 23 additions & 3 deletions lib/ical/property.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,30 @@ const TYPE_INDEX = 2;
const VALUE_INDEX = 3;

import design from "./design.js";
import ICALStringify from "./stringify.js";
import ICALParse from "./parse.js";

// needed for typescript type resolution
// eslint-disable-next-line no-unused-vars
import Component from "./component.js";
import ICALStringify from "./stringify.js";
import ICALParse from "./parse.js";
// needed for typescript type resolution
// eslint-disable-next-line no-unused-vars
import Duration from "./duration.js";
// needed for typescript type resolution
// eslint-disable-next-line no-unused-vars
import UtcOffset from "./utc_offset.js";
// needed for typescript type resolution
// eslint-disable-next-line no-unused-vars
import Binary from "./binary.js";
// needed for typescript type resolution
// eslint-disable-next-line no-unused-vars
import Period from "./period.js";
// needed for typescript type resolution
// eslint-disable-next-line no-unused-vars
import Recur from "./recur.js";
// needed for typescript type resolution
// eslint-disable-next-line no-unused-vars
import Time from "./time.js";

/**
* This lets typescript resolve our custom types in the
Expand Down Expand Up @@ -300,7 +319,8 @@ class Property {
/**
* Finds the first property value.
*
* @return {Object} First property value
* @return {Binary | Duration | Period |
* Recur | Time | UtcOffset | null} First property value
*/
getFirstValue() {
return this._hydrateValue(0);
Expand Down

0 comments on commit 6273d65

Please sign in to comment.