Skip to content
This repository was archived by the owner on May 22, 2025. It is now read-only.

Shared: Added typescript for times helper#17

Open
promaty wants to merge 6 commits into
developmentfrom
typescript
Open

Shared: Added typescript for times helper#17
promaty wants to merge 6 commits into
developmentfrom
typescript

Conversation

@promaty
Copy link
Copy Markdown
Contributor

@promaty promaty commented Nov 4, 2020

Starting with a single lib now, will add others in following PRs

@promaty promaty requested a review from facuspagnuolo November 4, 2020 18:44
@promaty promaty self-assigned this Nov 4, 2020
import { Session } from '../models/objection'

import { HOURS, DAYS } from '@aragon/protocol-backend-shared/helpers/times'
import { HOURS, DAYS } from '@aragon/protocol-backend-shared/build/helpers/times'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may be a dumb question, but when we update these other helpers to be in TS, would we be able to import the source files?

It seems a bit weird to have to do this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One way to do it would be to define main and types in package.json like I did in ipfs pinner and then have all imports in a single index.ts file:
https://github.com/aragonone/ipfs-pinner/blob/development/packages/shared/src/index.ts

In this case we could import the same thing like this:

import { times } from '@aragon/protocol-backend-shared
const { HOURS, DAYS } = times

I find this more verbose however and you also have to think about multiple imports/exports not just the source file directly.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants