-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f3fec05
commit 5bbae44
Showing
12 changed files
with
187 additions
and
70 deletions.
There are no files selected for viewing
File renamed without changes.
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 |
---|---|---|
|
@@ -9,4 +9,7 @@ export default stacks({ | |
typescript: true, | ||
jsonc: true, | ||
yaml: true, | ||
ignores: [ | ||
'fixtures/**' | ||
] | ||
}) |
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,32 @@ | ||
/** | ||
* Example of const declaration | ||
*/ | ||
export const config: { [key: string]: string } = { | ||
apiUrl: 'https://api.example.com', | ||
timeout: '5000', | ||
} | ||
|
||
/** | ||
* Example of interface declaration | ||
*/ | ||
export interface User { | ||
id: number | ||
name: string | ||
email: string | ||
} | ||
|
||
/** | ||
* Example of type declaration | ||
*/ | ||
export interface ResponseData { | ||
success: boolean | ||
data: User[] | ||
} | ||
|
||
/** | ||
* Example of function declaration | ||
*/ | ||
export function fetchUsers(): Promise<ResponseData> { | ||
return fetch(config.apiUrl) | ||
.then(response => response.json()) as Promise<ResponseData> | ||
} |
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,33 @@ | ||
/** | ||
* Example of another const declaration | ||
*/ | ||
export const settings: { [key: string]: any } = { | ||
theme: 'dark', | ||
language: 'en', | ||
} | ||
|
||
/** | ||
* Example of interface declaration | ||
*/ | ||
export interface Product { | ||
id: number | ||
name: string | ||
price: number | ||
} | ||
|
||
/** | ||
* Example of type declaration | ||
*/ | ||
export interface ApiResponse<T> { | ||
status: number | ||
message: string | ||
data: T | ||
} | ||
|
||
/** | ||
* Example of function declaration | ||
*/ | ||
export function getProduct(id: number): Promise<ApiResponse<Product>> { | ||
return fetch(`${settings.apiUrl}/products/${id}`) | ||
.then(response => response.json()) as Promise<ApiResponse<Product>> | ||
} |
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,34 @@ | ||
/** | ||
* Example of const declaration | ||
*/ | ||
export const endpoints = { | ||
getUsers: '/users', | ||
getProducts: '/products', | ||
} | ||
|
||
/** | ||
* Example of interface declaration | ||
*/ | ||
export interface Order { | ||
orderId: number | ||
userId: number | ||
productIds: number[] | ||
} | ||
|
||
/** | ||
* Example of type declaration | ||
*/ | ||
export interface OrderResponse { | ||
success: boolean | ||
order: Order | ||
} | ||
|
||
/** | ||
* Example of function declaration | ||
*/ | ||
export async function createOrder(order: Order): Promise<OrderResponse> { | ||
return fetch(endpoints.getProducts, { | ||
method: 'POST', | ||
body: JSON.stringify(order), | ||
}).then(response => response.json()) as Promise<OrderResponse> | ||
} |
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,30 @@ | ||
/** | ||
* Example of const declaration | ||
*/ | ||
export const apiKeys = { | ||
google: 'GOOGLE_API_KEY', | ||
facebook: 'FACEBOOK_API_KEY', | ||
} | ||
|
||
/** | ||
* Example of interface declaration | ||
*/ | ||
export interface AuthResponse { | ||
token: string | ||
expiresIn: number | ||
} | ||
|
||
/** | ||
* Example of type declaration | ||
*/ | ||
export type AuthStatus = 'authenticated' | 'unauthenticated' | ||
|
||
/** | ||
* Example of function declaration | ||
*/ | ||
export function authenticate(user: string, password: string): Promise<AuthResponse> { | ||
return fetch('/auth/login', { | ||
method: 'POST', | ||
body: JSON.stringify({ user, password }), | ||
}).then(response => response.json()) as Promise<AuthResponse> | ||
} |
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,30 @@ | ||
/** | ||
* Example of const declaration | ||
*/ | ||
export const defaultHeaders = { | ||
'Content-Type': 'application/json', | ||
} | ||
|
||
/** | ||
* Example of interface declaration | ||
*/ | ||
export interface Comment { | ||
id: number | ||
postId: number | ||
body: string | ||
} | ||
|
||
/** | ||
* Example of type declaration | ||
*/ | ||
export interface CommentsResponse { | ||
comments: Comment[] | ||
} | ||
|
||
/** | ||
* Example of function declaration | ||
*/ | ||
export function fetchComments(postId: number): Promise<CommentsResponse> { | ||
return fetch(`/posts/${postId}/comments`) | ||
.then(response => response.json()) as Promise<CommentsResponse> | ||
} |
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
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,12 +1,27 @@ | ||
/** | ||
* DtsGenerationConfig | ||
* | ||
* This is the configuration object for the DTS generation process. | ||
*/ | ||
export interface DtsGenerationConfig { | ||
cwd: string | ||
root: string | ||
outdir: string | ||
keepComments: boolean | ||
clean: boolean | ||
tsconfigPath?: string | ||
tsconfigPath: string | ||
} | ||
|
||
/** | ||
* DtsGenerationOption | ||
* | ||
* This is the configuration object for the DTS generation process. | ||
*/ | ||
export type DtsGenerationOption = Partial<DtsGenerationConfig> | ||
|
||
/** | ||
* DtsGenerationOptions | ||
* | ||
* This is the configuration object for the DTS generation process. | ||
*/ | ||
export type DtsGenerationOptions = DtsGenerationOption | DtsGenerationOption[] |
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,4 +1,7 @@ | ||
import { generateDeclarationsFromFiles } from './src' | ||
// Example usage | ||
generateDeclarationsFromFiles('./src'); | ||
import { generate } from './src' | ||
|
||
console.log('Generating declarations...') | ||
generate({ | ||
root: './src', | ||
}) | ||
console.log('Generated declarations') |