Skip to content

Commit f6b293d

Browse files
committed
Clean up type imports and fix rollup warning about using accessors.
1 parent 3cc48c6 commit f6b293d

File tree

4 files changed

+13
-14
lines changed

4 files changed

+13
-14
lines changed

linkset/src/core/link.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ interface RegisteredTargetAttributes {
2424
* An object that represents a link's target attributes.
2525
* @see {@link https://tools.ietf.org/html/draft-ietf-httpapi-linkset-00#section-4.2.4|draft-ietf-httpapi-linkset-00: Linkset §4.2.4}
2626
*/
27-
interface TargetAttributes extends RegisteredTargetAttributes {
27+
export interface TargetAttributes extends RegisteredTargetAttributes {
2828
readonly [name: string]: string | string[] | InternationalizedValue[];
2929
}
3030

linkset/src/core/linkset.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import { LinkInterface, Link } from './link';
2-
import { LinksetInterface as NormalizedLinksetInterface, TargetObject } from '../spec/linkset-json'
1+
import { Link } from './link';
2+
import type { LinkInterface } from './link';
3+
import type { LinksetInterface as NormalizedLinksetInterface, TargetObject } from '../spec/linkset-json'
34

45
/**
56
* A set of links and useful link utilities.
@@ -72,14 +73,10 @@ export class Linkset implements NormalizableLinksetInterface<NormalizedLinksetIn
7273
* {@inheritDoc LinksetInterface.elements}
7374
*/
7475
readonly elements: LinkInterface[];
76+
readonly size: number;
7577
constructor(links: LinkInterface[]) {
7678
this.elements = links;
77-
}
78-
/**
79-
* {@inheritDoc LinksetInterface.size}
80-
*/
81-
get size(): number {
82-
return this.elements.length;
79+
this.size = links.length;
8380
}
8481
/**
8582
* {@inheritDoc LinksetInterface.hasLinkTo}

linkset/src/index.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
import { LinksetInterface as NormalizedLinksetInterface } from './spec/linkset-json';
2-
import { LinkInterface } from './core/link';
3-
import { Linkset, LinksetInterface, NormalizableLinksetInterface } from './core/linkset';
1+
import { Linkset } from './core/linkset';
2+
import type { LinksetInterface as NormalizedLinksetInterface } from './spec/linkset-json';
3+
import type { LinkInterface } from './core/link';
4+
import type { LinksetInterface, NormalizableLinksetInterface } from './core/linkset';
45

56
/**
67
* Denormalizes a set of links into an instance of a Linkset.

linkset/src/spec/linkset-json.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { TargetAttributes } from './link';
1+
import type { TargetAttributes } from '../core/link';
22

33
/**
44
* An object that represents a link target object from the linkset spec.
@@ -12,8 +12,9 @@ export interface TargetObject extends TargetAttributes {
1212
* An object that represents a link context object from the linkset spec.
1313
* @see {@link https://tools.ietf.org/html/draft-ietf-httpapi-linkset-00#section-4.2.2|draft-ietf-httpapi-linkset-00: Linkset §4.2.2}
1414
*/
15-
interface ContextObject {
15+
type ContextObject = {
1616
anchor: string;
17+
} & {
1718
[rel: string]: TargetObject[];
1819
}
1920

0 commit comments

Comments
 (0)