Skip to content

Commit 6075a6c

Browse files
authored
refactor(*): create src/types.js (#174)
This pull request introduces a new file `src/types.js` to define common types used within the codebase. The changes include adding type definitions and ensuring type checking with TypeScript. Key changes: * Added a file overview comment to `src/types.js` to describe the purpose of the file. * Enabled TypeScript checking with the `@ts-check` comment. * Defined a `Uri` type as a string and a `Type` type as either `'link'` or `'image'`. * Created a `UriTypeObject` typedef that includes properties `uri` of type `Uri` and `type` of type `Type`. * Exported the module to make the types available for use in other files.
1 parent ee82bdf commit 6075a6c

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

src/types.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/**
2+
* @fileoverview Define common types.
3+
*/
4+
5+
// @ts-check
6+
7+
// --------------------------------------------------------------------------------
8+
// Typedefs
9+
// --------------------------------------------------------------------------------
10+
11+
/**
12+
* @typedef {string} Uri The URI. It should be `string` type.
13+
*/
14+
15+
/**
16+
* @typedef {'link' | 'image'} Type The type of URI. It should be either `'link'` or `'image'`.
17+
*/
18+
19+
/**
20+
* @typedef {object} UriTypeObject
21+
* @property {Uri} uri The URI. It should be `string` type.
22+
* @property {Type} type The type of URI. It should be either `'link'` or `'image'`.
23+
*/
24+
25+
// --------------------------------------------------------------------------------
26+
// Exports
27+
// --------------------------------------------------------------------------------
28+
29+
module.exports = {};

0 commit comments

Comments
 (0)