Skip to content
This repository was archived by the owner on Mar 7, 2023. It is now read-only.

Commit d0ed36c

Browse files
committed
chore: provide decorator return types
1 parent 3de47e4 commit d0ed36c

File tree

3 files changed

+24
-8
lines changed

3 files changed

+24
-8
lines changed

packages/@nsf-open/ember-currency-utils/addon/computed-macros.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import { fromUSDFormat, toUSDFormat } from './formatters';
1616
* public numericCost!: number; // => 12345.55
1717
* ```
1818
*/
19-
export function fromUSD(dependantKey: string) {
19+
export function fromUSD(dependantKey: string): PropertyDecorator {
2020
return computed(dependantKey, function computedFromUSD() {
2121
return fromUSDFormat(get(this, dependantKey));
2222
});
@@ -37,7 +37,7 @@ export function fromUSD(dependantKey: string) {
3737
* public formattedDouble!: string; // => "$12,345.55"
3838
* ```
3939
*/
40-
export function toUSD(dependantKey: string, showCentsOrOptions: ToFormatOptions | boolean = false) {
40+
export function toUSD(dependantKey: string, showCentsOrOptions: ToFormatOptions | boolean = false): PropertyDecorator {
4141
return computed(dependantKey, function computedToUSD() {
4242
return toUSDFormat(get(this, dependantKey), showCentsOrOptions);
4343
});

packages/@nsf-open/ember-datetime-utils/addon/computed-macros.ts

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,11 @@ import {
2020
* public formattedDate!: string; // => '10/25/1970'
2121
* ```
2222
*/
23-
export function middleEndianDateString(dependantKey: string, defaultValue: any = 'None', options: ParseOptions = {}) {
23+
export function middleEndianDateString(
24+
dependantKey: string,
25+
defaultValue: any = 'None',
26+
options: ParseOptions = {}
27+
): PropertyDecorator {
2428
return computed(dependantKey, function computedMiddleEndianDateString() {
2529
return toMiddleEndianDateString(get(this, dependantKey), defaultValue, options);
2630
});
@@ -38,7 +42,11 @@ export function middleEndianDateString(dependantKey: string, defaultValue: any =
3842
* public formattedTime!: string; // => '1:10 PM'
3943
* ```
4044
*/
41-
export function middleEndianTimeString(dependantKey: string, defaultValue: any = 'None', options: ParseOptions = {}) {
45+
export function middleEndianTimeString(
46+
dependantKey: string,
47+
defaultValue: any = 'None',
48+
options: ParseOptions = {}
49+
): PropertyDecorator {
4250
return computed(dependantKey, function computedMiddleEndianTimeString() {
4351
return toMiddleEndianTimeString(get(this, dependantKey), defaultValue, options);
4452
});
@@ -56,7 +64,11 @@ export function middleEndianTimeString(dependantKey: string, defaultValue: any =
5664
* public formattedDateTime!: string; // => '10/25/1970 1:10 PM'
5765
* ```
5866
*/
59-
export function middleEndianDateTimeString(dependantKey: string, defaultValue: any = 'None', options: ParseOptions = {}) {
67+
export function middleEndianDateTimeString(
68+
dependantKey: string,
69+
defaultValue: any = 'None',
70+
options: ParseOptions = {}
71+
): PropertyDecorator {
6072
return computed(dependantKey, function computedMiddleEndianDateTimeString() {
6173
return toMiddleEndianDateTimeString(get(this, dependantKey), defaultValue, options);
6274
});
@@ -74,7 +86,11 @@ export function middleEndianDateTimeString(dependantKey: string, defaultValue: a
7486
* public formattedDate!: string; // => '1970-10-25'
7587
* ```
7688
*/
77-
export function bigEndianDateString(dependantKey: string, defaultValue: any = 'None', options: ParseOptions = {}) {
89+
export function bigEndianDateString(
90+
dependantKey: string,
91+
defaultValue: any = 'None',
92+
options: ParseOptions = {}
93+
): PropertyDecorator {
7894
return computed(dependantKey, function computedBigEndianDateString() {
7995
return toBigEndianDateString(get(this, dependantKey), defaultValue, options);
8096
});

packages/@nsf-open/ember-username-utils/addon/computed-macros.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export function formatFirstNameFirst(
3737
middleNameKey: string,
3838
lastNameKey: string,
3939
options: FormatMacroOptions = {}
40-
) {
40+
): PropertyDecorator {
4141
const opts = { fallbackKey: 'id', defaultText: '', ...options };
4242
const keys = [firstNameKey, middleNameKey, lastNameKey, opts.fallbackKey].filter(Boolean) as DependantKeys;
4343

@@ -74,7 +74,7 @@ export function formatLastNameFirst(
7474
middleNameKey: string,
7575
lastNameKey: string,
7676
options: FormatMacroOptions = {}
77-
) {
77+
): PropertyDecorator {
7878
const opts = { fallbackKey: 'id', defaultText: '', ...options };
7979
const keys = [firstNameKey, middleNameKey, lastNameKey, opts.fallbackKey].filter(Boolean) as DependantKeys;
8080

0 commit comments

Comments
 (0)