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

ROU-3701: removing usage of type any #164

Merged
merged 12 commits into from
Feb 19, 2024
Original file line number Diff line number Diff line change
@@ -24,5 +24,6 @@ declare global {
type GoogleMapsMarkerClustererOptions = OriginalMarkerClustererOptions;
type GoogleMapsClusterRenderer = OriginalRenderer;
type GoogleMapsSuperClusterAlgorithm = OriginalSuperClusterAlgorithm;
type GoogleAdvancedFormatObj = {JSON, mapEvents: string[]};
}
window.GMCB = window.GMCB || {};
7 changes: 1 addition & 6 deletions src/OSFramework/Maps/FileLayer/AbstractFileLayer.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
// eslint-disable-next-line @typescript-eslint/no-unused-vars
namespace OSFramework.Maps.FileLayer {
export abstract class AbstractFileLayer<
W,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
T extends Configuration.IConfigurationFileLayer,
> implements IFileLayer
{
export abstract class AbstractFileLayer<W, T extends Configuration.IConfigurationFileLayer> implements IFileLayer {
/** Configuration reference */
private _config: T;
private _map: OSMap.IMap;
3 changes: 1 addition & 2 deletions src/OSFramework/Maps/FileLayer/IFileLayer.ts
Original file line number Diff line number Diff line change
@@ -7,8 +7,7 @@ namespace OSFramework.Maps.FileLayer {
fileLayerEvents: Event.FileLayer.FileLayersEventsManager;
isReady: boolean;
map: OSMap.IMap; //IMap
// eslint-disable-next-line @typescript-eslint/no-explicit-any
provider: any;
provider: unknown;
rugoncalves marked this conversation as resolved.
Show resolved Hide resolved
uniqueId: string;
widgetId: string;

7 changes: 3 additions & 4 deletions src/OSFramework/Maps/HeatmapLayer/IHeatmapLayer.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
// eslint-disable-next-line @typescript-eslint/no-unused-vars
namespace OSFramework.Maps.HeatmapLayer {
export interface IHeatmapLayer extends Interface.IBuilder, Interface.ISearchById, Interface.IDisposable {
config: Configuration.IConfigurationHeatmapLayer; //IConfigurationHeatmapLayer
config: Configuration.IConfigurationHeatmapLayer;
isReady: boolean;
map: OSMap.IMap; //IMap
// eslint-disable-next-line @typescript-eslint/no-explicit-any
provider: any;
map: OSMap.IMap;
provider: unknown;
uniqueId: string;
widgetId: string;

8 changes: 4 additions & 4 deletions src/OSFramework/Maps/Helper/JsonFormatter.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// eslint-disable-next-line @typescript-eslint/no-unused-vars
namespace OSFramework.Maps.Helper {
export function JsonFormatter(text: string): JSON {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
let json: any = {};
if (text === undefined || text === '') return json;
let json = {};
if (text === undefined || text === '') return json as JSON;

/* NO SONAR */
// text.substring(1, text.length - 1)
// .replace(/ /g, '')
// .split(',')
@@ -21,6 +21,6 @@ namespace OSFramework.Maps.Helper {
// eslint-disable-next-line no-eval
json = eval('(' + text + ')');

return json;
return json as JSON;
}
}
3 changes: 1 addition & 2 deletions src/OSFramework/Maps/Marker/IMarker.ts
Original file line number Diff line number Diff line change
@@ -8,8 +8,7 @@ namespace OSFramework.Maps.Marker {
isReady: boolean;
map: OSMap.IMap; //IMap
markerEvents: Event.Marker.MarkerEventsManager;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
provider: any;
provider: unknown;
uniqueId: string;
widgetId: string;

4 changes: 2 additions & 2 deletions src/OSFramework/Maps/OSMap/AbstractMap.ts
Original file line number Diff line number Diff line change
@@ -80,7 +80,7 @@ namespace OSFramework.Maps.OSMap {
return Array.from(this._markersSet);
}

public get markersReady(): W[] {
public get markersReady(): unknown[] {
// We need to go through all the markers and only get the ones that are ready (or have the provider defined)
// Then we need to return the providers inside a list
return this.markers.filter((marker) => marker.isReady).map((marker) => marker.provider);
@@ -236,7 +236,7 @@ namespace OSFramework.Maps.OSMap {
}

public hasMarkerClusterer(): boolean {
return this._features && this._features.markerClusterer && this._features.markerClusterer.isEnabled;
return this._features?.markerClusterer?.isEnabled;
}

public hasShape(shapeId: string): boolean {
6 changes: 2 additions & 4 deletions src/OSFramework/Maps/OSStructures/OSMap.Coordinates.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
// eslint-disable-next-line @typescript-eslint/no-unused-vars
namespace OSFramework.Maps.OSStructures.OSMap {
export class Coordinates {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
public lat: any;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
public lng: any;
public lat: number | (() => number);
public lng: number | (() => number);
}

// eslint-disable-next-line @typescript-eslint/naming-convention
8 changes: 6 additions & 2 deletions src/OutSystems/Maps/MapAPI/MarkerManager.ts
Original file line number Diff line number Diff line change
@@ -58,12 +58,16 @@ namespace OutSystems.Maps.MapAPI.MarkerManager {
if (map.providerType === OSFramework.Maps.Enum.ProviderType.Google) {
// Check if the feature is enabled!
if (map.hasMarkerClusterer()) {
const marker = map.markers.find((marker) => marker.provider.location === markerPosition);
const marker = map.markers.find((marker) => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
return (marker.provider as any).location === markerPosition;
});

// Check if there is a marker with the given Position/Location
if (marker !== undefined) {
map.features.markerClusterer.removeMarker(marker);
marker.provider.setMap(map.provider);
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(marker.provider as any).setMap(map.provider);
} else {
responseObj.isSuccess = false;
responseObj.message = `There are not a marker with position:'${markerPosition}' to be removed.`;
4 changes: 2 additions & 2 deletions src/OutSystems/Maps/MapAPI/ShapeManager.ts
Original file line number Diff line number Diff line change
@@ -55,8 +55,8 @@ namespace OutSystems.Maps.MapAPI.ShapeManager {
const properties = new OSFramework.Maps.OSStructures.API.CircleProperties();
if (shape.type === OSFramework.Maps.Enum.ShapeType.Circle) {
properties.Center = {
Lat: shape.providerCenter.lat,
Lng: shape.providerCenter.lng,
Lat: shape.providerCenter.lat as number,
Lng: shape.providerCenter.lng as number,
};
properties.Radius = shape.providerRadius;
} else {
Original file line number Diff line number Diff line change
@@ -8,13 +8,7 @@ namespace Provider.Maps.Google.Configuration.DrawingTools {
public strokeOpacity: number;
public strokeWeight: number;

// No need for constructor, as it is not doing anything. Left the constructor, to facilitade future usage.
// constructor(config: JSON) {
// super(config);
// }

// eslint-disable-next-line @typescript-eslint/no-explicit-any
public getProviderConfig(): any {
public getProviderConfig(): unknown[] {
const configs = super.getProviderConfig();
// eslint-disable-next-line prefer-const
let provider = {
Original file line number Diff line number Diff line change
@@ -9,11 +9,6 @@ namespace Provider.Maps.Google.Configuration.DrawingTools {
public allowDrag: boolean;
public uniqueId: string;

// No need for constructor, as it is not doing anything. Left the constructor, to facilitade future usage.
// constructor(config: JSON) {
// super(config);
// }

// eslint-disable-next-line @typescript-eslint/no-explicit-any
public getProviderConfig(): any {
// eslint-disable-next-line prefer-const
Original file line number Diff line number Diff line change
@@ -6,13 +6,7 @@ namespace Provider.Maps.Google.Configuration.DrawingTools {
public fillColor: string;
public fillOpacity: number;

// No need for constructor, as it is not doing anything. Left the constructor, to facilitade future usage.
// constructor(config: JSON) {
// super(config);
// }

// eslint-disable-next-line @typescript-eslint/no-explicit-any
public getProviderConfig(): any {
public getProviderConfig(): unknown[] {
const configs = super.getProviderConfig();
// eslint-disable-next-line prefer-const
let provider = {
Original file line number Diff line number Diff line change
@@ -5,13 +5,7 @@ namespace Provider.Maps.Google.Configuration.DrawingTools {
export class DrawMarkerConfig extends DrawConfig {
public iconUrl: string;

// No need for constructor, as it is not doing anything. Left the constructor, to facilitade future usage.
// constructor(config: JSON) {
// super(config);
// }

// eslint-disable-next-line @typescript-eslint/no-explicit-any
public getProviderConfig(): any {
public getProviderConfig(): unknown[] {
const provider = super.getProviderConfig();
provider.icon = this.iconUrl;

Original file line number Diff line number Diff line change
@@ -9,13 +9,7 @@ namespace Provider.Maps.Google.Configuration.DrawingTools {
public position: string;
public uniqueId: string;

// No need for constructor, as it is not doing anything. Left the constructor, to facilitade future usage.
// constructor(config: JSON) {
// super(config);
// }

// eslint-disable-next-line @typescript-eslint/no-explicit-any
public getProviderConfig(): any {
public getProviderConfig(): unknown {
return {
position: this.position,
};
Original file line number Diff line number Diff line change
@@ -10,13 +10,7 @@ namespace Provider.Maps.Google.Configuration.FileLayer {
public preserveViewport: boolean;
public suppressPopups: boolean;

// No need for constructor, as it is not doing anything. Left the constructor, to facilitade future usage.
// constructor(config: JSON) {
// super(config);
// }

// eslint-disable-next-line @typescript-eslint/no-explicit-any
public getProviderConfig(): any {
public getProviderConfig(): unknown {
// eslint-disable-next-line prefer-const
let provider = {
clickable: true,
Original file line number Diff line number Diff line change
@@ -13,13 +13,7 @@ namespace Provider.Maps.Google.Configuration.HeatmapLayer {
public points: Array<OSFramework.Maps.OSStructures.HeatmapLayer.Points>;
public radius: number;

// No need for constructor, as it is not doing anything. Left the constructor, to facilitade future usage.
// constructor(config: JSON) {
// super(config);
// }

// eslint-disable-next-line @typescript-eslint/no-explicit-any
public getProviderConfig(): any {
public getProviderConfig(): unknown {
// eslint-disable-next-line prefer-const
let provider = {
points: this.points,
Original file line number Diff line number Diff line change
@@ -14,13 +14,7 @@ namespace Provider.Maps.Google.Configuration.Marker {
public location: string;
public title: string;

// No need for constructor, as it is not doing anything. Left the constructor, to facilitade future usage.
// constructor(config: unknown) {
// super(config);
// }

// eslint-disable-next-line @typescript-eslint/no-explicit-any
public getProviderConfig(): any {
public getProviderConfig(): unknown {
const provider = {
draggable: this.allowDrag,
icon: this.iconUrl,
Original file line number Diff line number Diff line change
@@ -18,13 +18,7 @@ namespace Provider.Maps.Google.Configuration.OSMap {
public uniqueId: string;
public zoom: OSFramework.Maps.Enum.OSMap.Zoom;

// No need for constructor, as it is not doing anything. Left the constructor, to facilitade future usage.
// constructor(config: JSON) {
// super(config);
// }

// eslint-disable-next-line @typescript-eslint/no-explicit-any
public getProviderConfig(): any {
public getProviderConfig(): unknown {
const provider = {
center: this.center,
zoom: this.zoom,
Original file line number Diff line number Diff line change
@@ -11,13 +11,7 @@ namespace Provider.Maps.Google.Configuration.OSMap {
public uniqueId: string;
public zoom: OSFramework.Maps.Enum.OSMap.Zoom;

// No need for constructor, as it is not doing anything. Left the constructor, to facilitade future usage.
// constructor(config: JSON) {
// super(config);
// }

// eslint-disable-next-line @typescript-eslint/no-explicit-any
public getProviderConfig(): any {
public getProviderConfig(): unknown {
const provider = {
center: this.center,
zoom: this.zoom,
Original file line number Diff line number Diff line change
@@ -11,11 +11,6 @@ namespace Provider.Maps.Google.Configuration.SearchPlaces {
public searchArea: OSFramework.Maps.OSStructures.OSMap.BoundsString;
public searchType: OSFramework.Maps.Enum.SearchTypes;

// No need for constructor, as it is not doing anything. Left the constructor, to facilitade future usage.
// constructor(config: JSON) {
// super(config);
// }

public getProviderConfig(): ISearchPlacesProviderConfig {
// eslint-disable-next-line prefer-const
let provider: ISearchPlacesProviderConfig = {
Original file line number Diff line number Diff line change
@@ -14,11 +14,6 @@ namespace Provider.Maps.Google.Configuration.Shape {
public strokeWeight: number;
public uniqueId: string;

// No need for constructor, as it is not doing anything. Left the constructor, to facilitade future usage.
// constructor(config: unknown) {
// super(config);
// }

public getProviderConfig(): IShapeProviderConfig {
// eslint-disable-next-line prefer-const
let provider: IShapeProviderConfig = {
Original file line number Diff line number Diff line change
@@ -6,11 +6,6 @@ namespace Provider.Maps.Google.Configuration.Shape {
public center: string;
public radius: number;

// No need for constructor, as it is not doing anything. Left the constructor, to facilitade future usage.
// constructor(config: unknown) {
// super(config);
// }

public getProviderConfig(): IShapeProviderConfig {
const provider = super.getProviderConfig();
provider.radius = this.radius;
Original file line number Diff line number Diff line change
@@ -6,11 +6,6 @@ namespace Provider.Maps.Google.Configuration.Shape {
public fillColor: string;
public fillOpacity: number;

// No need for constructor, as it is not doing anything. Left the constructor, to facilitade future usage.
// constructor(config: unknown) {
// super(config);
// }

public getProviderConfig(): IShapeProviderConfig {
const provider_configs = super.getProviderConfig();
provider_configs.fillColor = this.fillColor;
Original file line number Diff line number Diff line change
@@ -5,11 +5,6 @@ namespace Provider.Maps.Google.Configuration.Shape {
export class RectangleShapeConfig extends FilledShapeConfig {
public bounds: string;

// No need for constructor, as it is not doing anything. Left the constructor, to facilitade future usage.
// constructor(config: unknown) {
// super(config);
// }

public getProviderConfig(): IShapeProviderConfig {
const provider = super.getProviderConfig();

Original file line number Diff line number Diff line change
@@ -65,8 +65,7 @@ namespace Provider.Maps.Google.DrawingTools {
super.build();
}

// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars
public changeProperty(propertyName: string, value: any): void {
public changeProperty(propertyName: string, value: unknown): void {
const propValue = OSFramework.Maps.Enum.OS_Config_Shape[propertyName];
super.changeProperty(propertyName, value);
if (this.drawingTools.isReady) {
Loading