-
Notifications
You must be signed in to change notification settings - Fork 3
Improved naming of anonymous types and types from files outside of functions.ts
#21
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This file is getting pretty gnarly.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, might pull it apart in another PR another time. There's still likely to be a biggish file though, I'd keep all the type derivation functions together. At least it's not 2.5MB like TypeScript! 😂 |
Large diffs are not rendered by default.
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| type AliasedObjectType = { | ||
| fullName: { firstName: string, surname: string } | ||
| intersectionFullName: { firstName: string } & { surname: string } | ||
| nestedType: { | ||
| coordinates: { x: number, y: number }, | ||
| nestedFullName: { firstName: string, surname: string }, | ||
| nestedIntersectionFullName: { firstName: string } & { surname: string } | ||
| }, | ||
| } | ||
|
|
||
| type GenericAliasedObjectType<T> = { | ||
| data: T | ||
| nestedAnonymous: { prop: T } | ||
| } | ||
|
|
||
| /** @readonly */ | ||
| export function anonymousTypes( | ||
| dob: { year: number, month: number, day: number }, | ||
| aliasedObjectType: AliasedObjectType, | ||
| stringGenericAliasedObjectType: GenericAliasedObjectType<string>, | ||
| numberGenericAliasedObjectType: GenericAliasedObjectType<number>, | ||
| ): { successful: boolean } { | ||
| return { successful: true }; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,7 @@ | ||
| export type AnotherType = { | ||
| prop: string | ||
| } | ||
|
|
||
| export type Foo = { | ||
| a: string, | ||
| b: number | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| import * as dep from './imported-types.dep'; | ||
| import * as commander from 'commander'; | ||
|
|
||
| /** @readonly */ | ||
| export function npmTypeImport(): commander.HelpContext { | ||
| return { error: false }; | ||
| } | ||
|
|
||
| /** @readonly */ | ||
| export function localTypeImport(): dep.AnotherType { | ||
| return { prop: "" }; | ||
| } | ||
|
|
||
| type Foo = { | ||
| x: boolean, | ||
| y: dep.Foo | ||
| } | ||
|
|
||
| export function conflictWithLocalImport(): Foo { | ||
| return { | ||
| x: true, | ||
| y: { | ||
| a: 'hello', | ||
| b: 33 | ||
| } | ||
| } | ||
| } | ||
|
|
||
| type ErrorOptions = { | ||
| retval: number | ||
| } | ||
|
|
||
| /** @readonly */ | ||
| export function conflictWithNpmImport(myErrorOptions: ErrorOptions): commander.ErrorOptions { | ||
| return { exitCode: myErrorOptions.retval }; | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.