DimensionDev / Maskbook-Talks

Where talks of Maskbook happen.
7 stars 1 forks source link

[Talk] Export module from index.ts using asterisk wildcard #53

Closed zhouhanseng closed 4 years ago

zhouhanseng commented 4 years ago

Inroduction and Background

I started to read the project. In InjectedComponents/PostDialog.tsx, I tired to find where's the declaration of type Profile.

I checked the database/index.ts:

import './migrate/index'
import './tasks/index'
export * from './helpers/avatar'
export * from './helpers/group'
export * from './Persona/helpers'
export * from './Persona/types'

I lost myself here. I think we can export module explicitly to make the code more readable:

import './migrate/index'
import './tasks/index'
export { AvatarRecord, AvatarDBSchema, createAvatarDBAccess } from './helpers/avatar'
export { Group } from './helpers/group'
export { profileRecordToProfile } from './Persona/helpers'
export { Profile } from './Persona/types'
Jack-Works commented 4 years ago

In the editor with fully TypeScript support you can let the editor suggest what things you can import from it and use jump to definition to see where it is defined.

septs commented 4 years ago

plz use https://aka.ms/vscode, thanks.

Jack-Works commented 4 years ago

Or any other IDEs that supports language service protocol. You can get list at https://microsoft.github.io//language-server-protocol/implementors/tools/