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

Export type 'CamelCaseKeys' #90

Merged
merged 3 commits into from Jun 6, 2022

Conversation

emmyakin
Copy link
Contributor

@emmyakin emmyakin commented Apr 6, 2022

Allows importing the defined type for use

// my type.ts file
type ApiResponse = {
	a: string,
    b: {
        snake_case_a: string;
        snake_case_b: string;
        snake_case_c: {
            snake_case_a: string;
            snake_case_b: string;
        }
    }
}

type ResultSet = {
    a: string,
    b: {
       snakeCaseA: string;
       snakeCaseB: string;
       snakeCaseC: {
         snakeCaseA: string;
         snakeCaseB: string;
      }
    }
}


// it would be easier to write ResultSet as
// my type.ts file

import type { CamelCaseKeys } from 'camelcase-keys';

type ResultSet = {
    a: string,
    b: CamelCaseKeys<ApiResponse, true>
}

@emmyakin
Copy link
Contributor Author

emmyakin commented Apr 8, 2022

@sindresorhus Fixed tests for ci build

@sindresorhus sindresorhus merged commit 87c57ac into sindresorhus:main Jun 6, 2022
@emmyakin emmyakin deleted the allow_types_to_be_imported branch July 20, 2022 19:02
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 this pull request may close these issues.

None yet

2 participants