Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add TypeScript Type Definitions #26

Open
rukundo-kevin opened this issue Oct 3, 2023 · 4 comments · May be fixed by #27
Open

Add TypeScript Type Definitions #26

rukundo-kevin opened this issue Oct 3, 2023 · 4 comments · May be fixed by #27

Comments

@rukundo-kevin
Copy link

Hello,

The project currently lacks type definitions, and I'm willing to take on the task of creating them

@songa1
Copy link

songa1 commented Oct 3, 2023

Wanted to say the same thing.

I am trying to use it in the Typescript App, but it lacks it. In the meantime, can you suggest another way to get Districts in Rwanda with Typescript? Or another package.

Thank you!

@rukundo-kevin
Copy link
Author

Wanted to say the same thing.

I am trying to use it in the Typescript App, but it lacks it. In the meantime, can you suggest another way to get Districts in Rwanda with Typescript? Or another package.

Thank you!

I don't know another package with TS support but you can use these type definitions in your project.

declare module "rwanda" {
  export function Provinces(): string[];

  export function Districts(province?: string): string[] | undefined;

  export function Sectors(
    province?: string,
    district?: string
  ): string[] | undefined;

  export function Cells(
    province?: string,
    district?: string,
    sector?: string
  ): string[] | undefined;

  export function Villages(
    province?: string,
    district?: string,
    sector?: string,
    cell?: string
  ): string[] | undefined;
} 

Put them inside a file named rwanda.d.ts in your src or types directory

@knowbee
Copy link
Owner

knowbee commented Oct 3, 2023

@rukundo-kevin Go ahead, PRs are welcome

@songa1
Copy link

songa1 commented Oct 4, 2023

Wanted to say the same thing.
I am trying to use it in the Typescript App, but it lacks it. In the meantime, can you suggest another way to get Districts in Rwanda with Typescript? Or another package.
Thank you!

I don't know another package with TS support but you can use these type definitions in your project.

declare module "rwanda" {
  export function Provinces(): string[];

  export function Districts(province?: string): string[] | undefined;

  export function Sectors(
    province?: string,
    district?: string
  ): string[] | undefined;

  export function Cells(
    province?: string,
    district?: string,
    sector?: string
  ): string[] | undefined;

  export function Villages(
    province?: string,
    district?: string,
    sector?: string,
    cell?: string
  ): string[] | undefined;
} 

Put them inside a file named rwanda.d.ts in your src or types directory

Thank you @rukundo-kevin

It is working well now!

@shyakadavis shyakadavis linked a pull request Oct 17, 2023 that will close this issue
20 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants