-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improved naming of anonymous types and types from files outside of `f…
…unctions.ts` (#21)
- Loading branch information
1 parent
7fa60b3
commit 2ab3967
Showing
12 changed files
with
1,043 additions
and
252 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 0 additions & 16 deletions
16
ndc-lambda-sdk/test/inference/naming-conflicts/conflict-from-import.ts
This file was deleted.
Oops, something went wrong.
85 changes: 0 additions & 85 deletions
85
ndc-lambda-sdk/test/inference/naming-conflicts/naming-conflicts.test.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
ndc-lambda-sdk/test/inference/type-naming/anonymous-types.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }; | ||
} |
4 changes: 4 additions & 0 deletions
4
...ing-conflicts/conflict-from-import.dep.ts → ...ference/type-naming/imported-types.dep.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
36 changes: 36 additions & 0 deletions
36
ndc-lambda-sdk/test/inference/type-naming/imported-types.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }; | ||
} |
Oops, something went wrong.