Skip to content
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

fix(cb2-8121): general improvements to the type system #1339

Merged
merged 4 commits into from
Jan 2, 2024

Conversation

pbardy2000
Copy link
Contributor

@pbardy2000 pbardy2000 commented Dec 18, 2023

Tech Debt

Generally the aim of this PR is to get the codebase to have a better source of truth for types, with better inference - all derived from the types package.

Changes:

  1. Changes use of unions of TechRecordType to use more succinct syntax
  2. Adds VehicleOtherThan utility type to exclude vehicle types from TechRecordType, this also replaces the NotTrailer type with this more general utility type, i.e. VehicleOtherThan<'trl'>
  3. Adds Empty utility type to convert another type into the same type but with nullable fields
  4. Adds Axles type which is derived from the techRecord_axles property of the V3 model and infers the specific properties of that axle based on the generic passed in, e.g. Axles<'psv'> returns an array of PSVAxles, where each item can have weights_kerbWeight. By default this uses the union of vehicle types which can have axles, i.e. 'hgv' | 'psv' | 'trl'
  5. Adds Axle type which is derived from the type of items of the Axles type array, and also provides the same generics
  6. Fixed no-explicit-any warning in axles service as the aforementioned types provide correct type inference

CB2-8121

Checklist

  • Branch is rebased against the latest develop/common
  • Code and UI has been tested manually after the additional changes
  • PR title includes the JIRA ticket number
  • Squashed commits contain the JIRA ticket number
  • Delete branch after merge

@github-actions github-actions bot added the bug Something isn't working label Dec 18, 2023
@pbardy2000 pbardy2000 marked this pull request as ready for review December 18, 2023 13:02
shivangidas
shivangidas previously approved these changes Dec 20, 2023
@pbardy2000 pbardy2000 merged commit 03dcd46 into develop Jan 2, 2024
10 checks passed
@pbardy2000 pbardy2000 deleted the feat/cb2-8121-14 branch January 2, 2024 10:14
JunYanBJSS pushed a commit that referenced this pull request Feb 26, 2024
* fix(cb2-8121): general improvements to the type system

* fix(cb2-8121): fix linting error

* fix(cb2-8121): rename type

* fix(cb2-8121): rename type
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants