Skip to content

Commit

Permalink
Merge pull request #164 from OutSystems/ROU-3701
Browse files Browse the repository at this point in the history
ROU-3701: removing usage of type `any`
  • Loading branch information
rugoncalves authored Feb 19, 2024
2 parents 5f6e020 + ec16fde commit 2e48230
Show file tree
Hide file tree
Showing 72 changed files with 187 additions and 370 deletions.
1 change: 1 addition & 0 deletions src/Providers/Maps/Google/Global.d.ts → src/Global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 1 addition & 2 deletions src/OSFramework/Maps/FileLayer/IFileLayer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
uniqueId: string;
widgetId: string;

Expand Down
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;

Expand Down
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(',')
Expand All @@ -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
Expand Up @@ -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;

Expand Down
4 changes: 2 additions & 2 deletions src/OSFramework/Maps/OSMap/AbstractMap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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 {
Expand Down
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
Expand Down
8 changes: 6 additions & 2 deletions src/OutSystems/Maps/MapAPI/MarkerManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.`;
Expand Down
4 changes: 2 additions & 2 deletions src/OutSystems/Maps/MapAPI/ShapeManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
3 changes: 1 addition & 2 deletions src/Providers/Maps/Google/DrawingTools/AbstractDrawShape.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Loading

0 comments on commit 2e48230

Please sign in to comment.