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

Redo Typescript migration #133

Open
wants to merge 15 commits into
base: main
Choose a base branch
from
Open

Redo Typescript migration #133

wants to merge 15 commits into from

Conversation

Tristan-WorkGH
Copy link
Member

Please check if the PR fulfills these requirements

  • The commit message follows our guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

Does this PR already have an issue describing the problem?

#131

What kind of change does this PR introduce?

Re-apply fixed types of #121, with minimal changes of code outside of types (lots of @ts-ignore as consequence).

What is the current behavior?

Some classes & components in JS, and some .d.ts not in sync with JS.

What is the new behavior (if this is a feature change)?
All files migrated to TypeScript with the types fixed and unified.

Does this PR introduce a breaking change or deprecate an API?

  • Yes
  • No

If yes, please check if the following requirements are fulfilled

  • The Breaking Change or Deprecated label has been added
  • The migration steps are described in the following section

What changes might users need to make in their application due to this PR? (migration steps)

The API is the same but the types has been updated.

Other information:

@danmarshall/deckgl-typings has been added temporally, the migration to deck.gl v9 coming soon, and the postinstall script is to cancel the copy of files that the postinstall of deckgl-typings is doing (copying files in node_modules/@types/) because it conflict with deck.gl typing preview (look at deckgl.d.ts).

Signed-off-by: Tristan Chuine <[email protected]>
Signed-off-by: Tristan Chuine <[email protected]>
Signed-off-by: Tristan Chuine <[email protected]>
Signed-off-by: Tristan Chuine <[email protected]>
Signed-off-by: Tristan Chuine <[email protected]>
Signed-off-by: Tristan Chuine <[email protected]>
Signed-off-by: Tristan Chuine <[email protected]>
Signed-off-by: Tristan Chuine <[email protected]>
Signed-off-by: Tristan Chuine <[email protected]>
Signed-off-by: Tristan Chuine <[email protected]>
Signed-off-by: Tristan Chuine <[email protected]>
Signed-off-by: Tristan Chuine <[email protected]>
seem that tsc still check json now?...
Signed-off-by: Tristan Chuine <[email protected]>
@@ -384,7 +446,7 @@ export class ArrowLayer extends Layer {
.draw();
}

_getModel(gl) {
_getModel(gl: ConstructorParameters<typeof Model>[0]) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On pourrait utiliser ici WebGLRenderingContext ?

.setUniforms({
sizeMinPixels,
sizeMaxPixels,
linePositionsTexture,
lineDistancesTexture,
linePositionsTextureSize: [linePositionsTexture.width, linePositionsTexture.height],
lineDistancesTextureSize: [lineDistancesTexture.width, lineDistancesTexture.height],
// @ts-expect-error TODO TS2339: Properties width and height does not exists on type Texture2D
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ici on ne passe pas opacity que l'on peut obtenir de this.props et qui fait pourtant bien parti des props de la layer.

this.state = {
maxTextureSize,
webgl2: isWebGL2(gl),
};

this.getAttributeManager().addInstanced({
this.getAttributeManager()?.addInstanced({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On pourrait définir l'instanced attribute getProximityFactors comme Accessor dans les _ArrowLayerProps.

metaVoltageLevelsByNominalVoltage: MetaVoltageLevelsByNominalVoltage[];
};

initializeState(...args: Parameters<CompositeLayer<Required<_SubstationLayerProps>>['initializeState']>) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A t'on vraiment besoin du spread et ne peut pas pas utiliser (context: LayerContext) comme dans la définition de super.initializeState ? Mais c'est peut être un mauvais typage de deck.gl ?

let factor = getDistance(firstPosition, secondPosition) / (3 * this.props.distanceBetweenLines);
if (factor > 1) {
factor = 1;
}
return factor;
}

computeAngle(props, position1, position2) {
computeAngle(props: UpdateParameters<this>['props'], position1: LonLat, position2: LonLat) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On pourrait utiliser this['props'] au lieu de UpdateParameters<this>['props'].

linesStatus: Map<string, LinesStatus>;
};

initializeState(...args: Parameters<CompositeLayer<Required<_LineLayerProps>>['initializeState']>) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A t'on vraiment besoin du spread et ne peut pas pas utiliser (context: LayerContext) comme dans la définition de super.initializeState ? Mais c'est peut être un mauvais typage de deck.gl ?

@@ -43,7 +65,7 @@ export class GeoData {
.forEach((id) => this.substationPositionsById.delete(id));
}

getSubstationPosition(substationId) {
getSubstationPosition(substationId: string) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On pourrait typer le retour en LonLat (par défaut c'est number[]).

@@ -72,7 +94,7 @@ export class GeoData {
/**
* Get line positions always ordered from side 1 to side 2.
*/
getLinePositions(network, line, detailed = true) {
getLinePositions(network: MapEquipments, line: MapAnyLine, detailed = true) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On pourrait typer le retour en LonLat[] (par défaut c'est any[]).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Breaking change API is broken
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants