question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Type RequestTransformFunction should be RequestTransformFunction

See original GitHub issue

While building my project, I noticed that the RequestTransformFunction type is incorrectly named versus @types/mapbox-gl. See https://github.com/DefinitelyTyped/DefinitelyTyped/blob/c6f73c8050c16ceb3a9ac23df466361e9e22a4a1/types/mapbox-gl/index.d.ts

The error message when I compile with TypeScript:

/node_modules/react-mapbox-gl/lib/map.d.ts
(82,13): Subsequent property declarations must have the same type.  Property 'transformRequest' must be of type 'TransformRequestFunction | undefined', but here has type 'RequestTransformFunction | undefined'.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:12
  • Comments:9 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
amwill04commented, Mar 4, 2019

The types seem to be all over the place. Having massive problems.

First after installing @types/supercluster you get "@types/supercluster" has no exported member 'Supercluster' so to fix that set version to @types/supercluster@3.0.2.

Then have this problem which I solved by basically changing the type name from RequestTransformFunction to TransformRequestFunction in map.d.ts.

No idea if this is an ideal fix or what problems I will run into - but it compiles.

EDIT

map.d.ts

I have deleted these lines :

export declare type RequestTransformFunction = (url: string, resourceType: any) => any;
//
//
declare global {
    namespace mapboxgl {
        interface MapboxOptions {
            failIfMajorPerformanceCaveat?: boolean;
            transformRequest?: RequestTransformFunction;
        }
    }
}

and then replaced

export interface FactoryParameters {
    accessToken: string;
    apiUrl?: string;
    minZoom?: number;
    maxZoom?: number;
    hash?: boolean;
    preserveDrawingBuffer?: boolean;
    scrollZoom?: boolean;
    interactive?: boolean;
    dragRotate?: boolean;
    attributionControl?: boolean;
    customAttribution?: string | string[];
    logoPosition?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
    renderWorldCopies?: boolean;
    trackResize?: boolean;
    touchZoomRotate?: boolean;
    doubleClickZoom?: boolean;
    keyboard?: boolean;
    dragPan?: boolean;
    boxZoom?: boolean;
    refreshExpiredTiles?: boolean;
    failIfMajorPerformanceCaveat?: boolean;
    bearingSnap?: number;
    injectCSS?: boolean;
    transformRequest?: MapboxGl.TransformRequestFunction; // use the type exposed from Mapbox types
}
2reactions
henrinormakcommented, Jan 16, 2019

Would also be interested in a fix for this, seems like a fairly serious problem (in essence the library is not useable).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Request Transformation Functions - Oracle Help Center
A request transformation function is generally specified on the service endpoint. This can also be specified on the Service Data Provider variable, ...
Read more >
Request and Response Transforms
Request transforms. Request transforms include the request path, query, HTTP version, method, and headers. In code these are represented by the ...
Read more >
Request Transformer plugin - Kong Docs
The Request Transformer plugin for Kong allows simple transformation of requests before they reach the upstream server. These transformations can be simple ...
Read more >
Transform Requests - Adobe Developer
Add a request to transform a file in the build. This function is passed as the first argument to an interceptor of the...
Read more >
actix_service::Transform - Rust - Docs.rs
An asynchronous function for transforming service call result. Associated Types. type Request [−]. Requests handled by the service. type Response ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found