Skip to content

Commit

Permalink
[lookup-by-path] Exclude null
Browse files Browse the repository at this point in the history
  • Loading branch information
dmichon-msft committed Dec 18, 2024
1 parent ae94f6c commit 6deecb7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"changes": [
{
"packageName": "@rushstack/lookup-by-path",
"comment": "Update all methods to accept optional override delimiters. Add `size`, `entries(), `get()`, `has()`, `removeItem()`. Make class iterable.\nExplicitly exclude `undefined` from the allowed types for the type parameter `TItem`.",
"comment": "Update all methods to accept optional override delimiters. Add `size`, `entries(), `get()`, `has()`, `removeItem()`. Make class iterable.\nExplicitly exclude `undefined` and `null` from the allowed types for the type parameter `TItem`.",
"type": "minor"
}
],
Expand Down
6 changes: 3 additions & 3 deletions common/reviews/api/lookup-by-path.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
```ts

// @beta
export interface IPrefixMatch<TItem extends {} | null> {
export interface IPrefixMatch<TItem extends {}> {
index: number;
lastMatch?: IPrefixMatch<TItem>;
value: TItem;
}

// @beta
export interface IReadonlyLookupByPath<TItem extends {} | null> extends Iterable<[string, TItem]> {
export interface IReadonlyLookupByPath<TItem extends {}> extends Iterable<[string, TItem]> {
[Symbol.iterator](query?: string, delimiter?: string): IterableIterator<[string, TItem]>;
entries(query?: string, delimiter?: string): IterableIterator<[string, TItem]>;
findChildPath(childPath: string, delimiter?: string): TItem | undefined;
Expand All @@ -25,7 +25,7 @@ export interface IReadonlyLookupByPath<TItem extends {} | null> extends Iterable
}

// @beta
export class LookupByPath<TItem extends {} | null> implements IReadonlyLookupByPath<TItem> {
export class LookupByPath<TItem extends {}> implements IReadonlyLookupByPath<TItem> {
[Symbol.iterator](query?: string, delimiter?: string): IterableIterator<[string, TItem]>;
constructor(entries?: Iterable<[string, TItem]>, delimiter?: string);
clear(): this;
Expand Down
8 changes: 4 additions & 4 deletions libraries/lookup-by-path/src/LookupByPath.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
/**
* A node in the path trie used in LookupByPath
*/
interface IPathTrieNode<TItem extends {} | null> {
interface IPathTrieNode<TItem extends {}> {
/**
* The value that exactly matches the current relative path
*/
Expand All @@ -31,7 +31,7 @@ interface IPrefixEntry {
*
* @beta
*/
export interface IPrefixMatch<TItem extends {} | null> {
export interface IPrefixMatch<TItem extends {}> {
/**
* The item that matched the prefix
*/
Expand All @@ -51,7 +51,7 @@ export interface IPrefixMatch<TItem extends {} | null> {
*
* @beta
*/
export interface IReadonlyLookupByPath<TItem extends {} | null> extends Iterable<[string, TItem]> {
export interface IReadonlyLookupByPath<TItem extends {}> extends Iterable<[string, TItem]> {
/**
* Searches for the item associated with `childPath`, or the nearest ancestor of that path that
* has an associated item.
Expand Down Expand Up @@ -178,7 +178,7 @@ export interface IReadonlyLookupByPath<TItem extends {} | null> extends Iterable
* ```
* @beta
*/
export class LookupByPath<TItem extends {} | null> implements IReadonlyLookupByPath<TItem> {
export class LookupByPath<TItem extends {}> implements IReadonlyLookupByPath<TItem> {
/**
* The delimiter used to split paths
*/
Expand Down

0 comments on commit 6deecb7

Please sign in to comment.