-
Notifications
You must be signed in to change notification settings - Fork 61
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
Add type definitions for core objects, add typescript-eslint-plugin + tsd (re-opened) #230
Add type definitions for core objects, add typescript-eslint-plugin + tsd (re-opened) #230
Conversation
001fc53
to
619a999
Compare
package.json
Outdated
@@ -15,21 +15,23 @@ | |||
"banners": "./utils/maintain-banners.js", | |||
"prebuild": "rimraf ./src/models ./src/factories ./src/generated-client.js", | |||
"build": "okta-sdk-generator -t templates/ -o .", | |||
"eslint": "eslint -c src/.eslintrc src/ && eslint -c test/.eslintrc test/it test/unit && eslint -c test/jest/.eslintrc test/jest/ && eslint -c src/.eslintrc utils/", | |||
"eslint": "eslint -c src/.eslintrc src/ --ignore-pattern 'src/types/' && eslint -c test/.eslintrc test/it test/unit && eslint -c test/jest/.eslintrc test/jest/ && eslint -c src/.eslintrc utils/ && eslint -c templates/.eslintrc templates && eslint -c src/types/.eslintrc src/types", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about refactoring the lint rule to have the common rules sit in the root directory, then specific rules in each separated dirs? Then the lint command can be changed to eslint .
.
src/types/index.test-d.ts
Outdated
@@ -0,0 +1,95 @@ | |||
import { expectType } from 'tsd'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about split this file to match/test different modules separately so we don't create a monster test file in the future?
Also, looks like we are using dtslint
in okta-react-native
, I am not really sure what's the difference between them, but it would be good to keep the test lib consistent cross repos.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 It definitely makes sense to break up type test into smaller files.
tsd
seemed like a better choice as it does not depend on deprecated tslint package. There is no much difference otherwise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some comments, LGTM in general!
9a47564
to
400c05b
Compare
8b81ec3
to
34d57b7
Compare
62a9991
to
60b2fa0
Compare
* to be switched to Client in the downnstream branch
60b2fa0
to
05a7859
Compare
add generated models and factories types (#225) * WIP on generating TS type declarations for operations * add templates for type files and add template helper functions * move typings to src/types * re-use signature getter for models and generated client * add types index and remove unused templates * unify export syntax * reduce blocklisted models filtering duplication * export model types * add factories templates and push generated model types * switch to named model exports * actually run eslint on templates dir * set proper return type for Collection and mark optional arguments * mark read-only properties * do default export models along with named export * expose Client type and add missing types * add re-generated models and remove manually-generated types * restore array type value and read-only modifier * bring models named export back * generate factories types * export GeneratedClient * to be switched to Client in the downnstream branch * specify correct types for Model constructor arguments * import Client for all models * remove default exports from models * remove models and factories index template * add extra newline for generated models, remove indents from type map, do not re-export model types * move eslint target for templates to downstream branch * add missing 'autogenerated' warning banner to templates * remove extra whitespaces, regenerate files * parametrize Collection return type in generated files * include generic type into imports list and re-generate types * preserve non-optinal query parameters * correct return type to be Response instead of undefined, include CRUD return type into imports * CR: remove copyright banners from templates Add type definitions for core objects, add typescript-eslint-plugin + tsd (re-opened) (#230) * WIP on generating TS type declarations for operations * WIP on adding types for core objects * update type references in core objects * WIP on adding types for core objects * update type references in core objects * run typescript-eslint on src/types * WIP on fixing ts-lint errors * represent object type as Record<string, unknown> * define RequestOptions type * define more specific type for core objects * add basic tsd test * install @types/node-fetch types * specify sourceType: module for types eslint config * add more tsd assertions * complete basic coverage for core object types assertions * include tsd run into test target * export types matching code exports * fix syntactic error in command * fix indents and apply basic eslint rules to definitions files * parametrize Collection type definition * list known config properties, update jwt function return type * widen type for cache middleware next function * replace MemoryStore references with CacheStorage * extract IRequestExecutor interface, make MemoryStore parameters optional * allow request executors w/o event emission * correct types for collection subscribers * CR: cascade eslint configuration * fix revealed eslint errors * move type tests to a separate directory * CR: break down type tests * add type assertions for generated client methods * use named import for Response * allow imports for create and delete operations only * remove unused import * fix rebase artifact remove irrelevant changes update changelog entry for 4.5.0 OKTA-373751 <<<Jenkins Check-In of Tested SHA: 1013098 for [email protected]>>> Artifact: okta-sdk-nodejs
Resolves OKTA-291118 and OKTA-291119