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

Typescript: Remove @mapbox/geojson-types and replace with @types/GeoJSON' #221

Merged
merged 2 commits into from
Jul 23, 2021

Conversation

chippieTV
Copy link
Contributor

  • confirm your changes do not include backports from Mapbox projects (unless with compliant license) - if you are not sure about this, please ask!

  • Remove imports of @mapbox/geojson-types

  • Update GeoJSON types (untested build as TS WIP, but reduces tsc errors)

  • Errors from 615 -> 609

  • Marked as draft because currently difficult to test. I will try to improve the PR when I can get things building and more stable

  • add an entry inside this element for inclusion in the maplibre-gl-js changelog: <changelog></changelog>

@lseelenbinder
Copy link
Member

Looks good to me, aside from testing. Thanks @chippieTV!

@@ -40,7 +38,7 @@ class Feature {
};
for (const i in this) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think Object.keys(...) will be better here and or simply clone using JSON.parse(JSON.Stringify) and remove the non-required fields. not sure. probably the first one is good enough...

Copy link
Contributor Author

@chippieTV chippieTV Jul 23, 2021

Choose a reason for hiding this comment

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

I left the other errors alone in the hope to make a targeted PR, (I actually removed another unrelated file change and push force to put it in a different misc PR).

So for this, the Maplibre code conventions mentioned not using certain features to keep compatibility with IE11.. Spread falls into that. Otherwise the whole thing could be reduced like this:

// BEFORE
toJSON() {
    const json = {
        geometry: this.geometry
    };

    for (const i in this) {
        if (i === '_geometry' || i === '_vectorTileFeature') continue;
        json[i] = (this as any)[i];
    }
    return json;
}

// AFTER
toJSON() {
  // some tslint/eslint ignore-next-line unused-vars hint
  const {_geometry, _vectorTileFeature, ...json} = this;
  return json;
}

TS Playground link

But in theory we can't do that right?

So I don't know how far we want to go, it's possible to set the TS compiler to output whatever we want compatibility wise, so writing up to date syntax (we're not writing JS at this point anyway) and output to ES5 might be a good option if we really want to support IE11?

(some blog post about target versions)

It's quite a broad decision so I can't make it, nor guarantee that it's the right way to go as it's quite specifically against the code conventions, however I assume so is TS..

Copy link
Collaborator

Choose a reason for hiding this comment

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

No need to support IE 11.
But the code you wrote is not equivalent to the original code :-)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

😮 really?!

so weird to me.. I mean, if geometry exists on this why doesn't it get extracted into json?.. because get/set?

confirmed you're right though TS playground

Copy link
Collaborator

Choose a reason for hiding this comment

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

No, no, you added extra fields to the json that are removed as part of this method. See the continue line above... :-)

Copy link
Collaborator

Choose a reason for hiding this comment

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

In the version that uses "..." I mean...
I think Object.keys is good enough for now...

Copy link
Contributor Author

@chippieTV chippieTV Jul 23, 2021

Choose a reason for hiding this comment

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

so my understanding of what I wrote is

original

  1. create json object with geometry property from this.geometry
  2. loop through all properties on this
  3. if current property is _geometry or _vectorTileFeature, skip adding to json object
  4. if current property is anything else, add to json object
  5. return json object

my spread operator version is saying

  1. save _geometry and _vectorTileFeature as separate consts (then throw them away - same as the if/continue bit)
  2. assign everything else to json

like this

Copy link
Collaborator

Choose a reason for hiding this comment

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

You are right, I misread it :-) my bad...
I think the new version is just fine.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it's good to keep an eye on it though, hopefully the test suite can do some magic and pick up any weirdness introduced in this or any other of the changes we make converting to TS!

@HarelM
Copy link
Collaborator

HarelM commented Jul 22, 2021

Other than the above looks good to me.

@HarelM
Copy link
Collaborator

HarelM commented Jul 23, 2021

You want me to merge this? I see that the title is draft...?

@chippieTV chippieTV changed the title Draft: Remove @mapbox/geojson-types and replace with @types/GeoJSON' Typescript: Remove @mapbox/geojson-types and replace with @types/GeoJSON' Jul 23, 2021
@chippieTV
Copy link
Contributor Author

I removed draft, if you're happy with it it's fine with me

@HarelM HarelM merged commit 08ddb2c into maplibre:typescript Jul 23, 2021
HarelM added a commit that referenced this pull request Sep 3, 2021
* Update README.md

* Initial commit - only rename and flow to typescript conversion

* Iint upgrade

* More lint fixes

* Updated lint command, added build typescript command

* Add non typed modules according to ts fork.

* Switch from yarn to npm

* Fix hasOwnProperty lint errors
See https://eslint.org/docs/rules/no-prototype-builtins
* I used this command for the conversions:
* sed -i -E "s/([\(\!])([]/[a-zA-Z_.-]*).hasOwnProperty\(/
\1Object.prototype.hasOwnProperty.call(\2, /g" <file-name>

* Fix extension from .js to .ts

* Remove types file

* Ignore lint errors

* Remove .ts extension in import

* Update CI from node v10 to v14

* Replace yarn with npm

* Remove circleci

* Fixed some typings errors

* Explicitly convert matrix-gl types

* Automatically fix lint errors

* Avoid Function as callback type

* Add missing MapOptions

* Add pitchWithRotate to MapOptions and pass explicit options to HandlerManager and Camera

* Set type of MapOptions.style to StyleSpecification of string

* Make Camera an abstract class

* Use Float32Array instead of Float64Array and cast types

* Make object dynamically extendable
See https://stackoverflow.com/questions/12710905/how-do-i-dynamically-assign-properties-to-an-object-in-typescript

* Make more objects dynamically extenable

* Explicit cast of array to length 2

* Do not provide type any in for..in loop

* Make more objects dynamically extenable

* Cast layout.get return value to Number

* Cast number | void to number

* Specify Rect type

* Make thhird argument of getKey optional

* Cast number | void to number

* Define return type of parse() in subclasses of Expression

* Cast return type of context.error() from void to null

* Cast style-spec types to Type

* Cast return type of context.error() from void to null

* Cast style-spec types to Type

* Cast dict to StylePropertySpecification

* Specify array type as any to fix string[] inference

* Make third argument of coalesce() optional

* Explicit casts to Evaluate, Varargs, and Signature

* Revert "Cast style-spec types to Type"

This reverts commit 4af74a6.

* Revert "Cast style-spec types to Type"

This reverts commit efc4b1f.

* Cast style-spec types at their source

* Typescript: Remove @mapbox/geojson-types and replace with @types/GeoJSON' (#221)

* remove @mapbox/geojson-types and replace with @types/GeoJSON

* update toJSON using spread operator

* add type to import GLSL as strings (#222)

* Typescript: Use library to handle Window type (#223)

* add window type lib

* remove internal window type file and use lib

* Fix issues related to possibly evaluated design

* Move IControl interface to a new class, Fix timeoutID type.

* remove flow-typed folder (#225)

* Typescript: Remove reference to @mapbox/point-geometry TBC (#226)

* Remove reference to @mapbox/point-geometry and replace with local point module with types
Remove commented out types
Fix cannot find type Point errors
Add static to fix convert does not exist on typeof Point errors

* Remove @mapbox/point-geometry from packkage.json

* Fix lint

* Typescript: fix lint and update .eslintrc with alternate TS rule (#227)

* fix lint and .eslintrc with alternate TS rule

* remove comment

* Typescript: a number of minor fixes from WIP branch (#228)

* fix minor ID type issues

* minor casting fix non bool to bool

* fix thrown Error message issue

* fix a couple of import issues

* match date comparison types

* remove commented out code

* fixes from WIP branch

* remove redundant import for lint

* more fixes

* Fix small typings issues

* More typescript fixes

* More fixes to typings, lint fixes

* Change base calls to be abstract

* More type fixes

* More types fixes

* More types fixes

* update use of mat4 (#219)

updating types as gl-matrix
more types to gl-matrix
cleanup cast vs constructor
cleanup more gl-matrix types
more using gl-matrix instead of Float32Array
fixes from WIP squashed into one commit
minor cleanup and comments

* Added some "as any" to places in the code where the typing were not just right and the method are proplemeatic...

* More types fixing, not perfect but good enough.

* Fix last typescript errors

* Fix incorrect typings and code errors.

* Remove flow from rollup and add tsc to build

* Format file

* Fix rollup build

* Initial commit to make the render test run

* Remove unneeded window import from all files

* Remove version from API

* More mock fixes to be able to run tests

* fix running of test-expression (#232)

* Add build phase before running some of the tests

* Fix tests get stuck, still tests are failing...

* get node query tests running (#233)

* Fix mocking of case of tilejson implementation.

* Typescript: Fix unit-tests (#235)

* Move all referneces in unit test to use the build output

* Fixes to window related stuff in unit tests, fixes to unneeded requires.

* Fix to dem data test

* Fix tests - remove window restore, fix __dirname.

* Fix stub_loader due to function this usage.

* Fix more tests

* Fix tests and code that causes tests to fail.

* Fix usage of ajax.js by subbing it correctly

* Added missing window element to tests

* removing window in 2 places gains 1601 passing (#236)

* Adding missing windows to tests

* Fix tests, revert some changes from typescript migration

* More fixes related to removal of window

* remove warnings, fix attribution test

* Fix more tests

* Fix more tests

* Added missing stubs

* Fixed tests related to version removal

* More test fixes related to file path

* Typescript: unit tests Frustum issues (#238)

* fix minor file errors in stub_loader.js

* matrix tests pass but not sure the tests represent actual usage

* Fix primitive tests with minimal usage of "bad" types

* Minor fixes to reduce incorrect typings

* Fix image load for image source and style tests

* Fix tests, added missing stub_loader

* Fix uuid incorrect implemetation

* Fix ajax tests. imporved image mock

* Fix camera tests

* Revert changes related to incorrect typescript solution

Co-authored-by: James Hamilton <chippieTV@users.noreply.github.com>

* Incorrect invocation of build-dev...

* Fix lint errors

* Removed test flow

* Fix build csp, started to fix style build

* Fix css build

* Remove to vec3 as to code review requirements

* Remove flow from build in ci

* Remove references to @mapbox/point-geometry

* Allow building style-spec

* Fix build tests

* Remove window, fix missing references to FeatureIndex using typescript config, update rollup dependencies

* Fix lint

* Fix production build

* Remove buble, stop compiling for es5

* Added missing global definitions after removing window

* Fix tests, bring back web_worker mock file, fix maplibre-gl loading issue, revert tsconfig.

* Fix build?

* Fix lint

* Typescript: Fix query-tests (#240)

* Initial commit to fix query-tests

* Fix query tests

* Fix some lint issues

* Typescript: minor fixes to formatting (#241)

* minor fixes

* fix formatting of object key value types

* Remove unneeded comments

* Fix according to code review

* Remove undefined as any

* Fix according to code review requirements.

* Fix lint

* More lint cover and fixes

* Fix lint for windows, update versions.

* Fix browser tests due to incorrect lint fix

* Fix lint for land.html

* Fix minimal node version to 14

* Typescript: merge from main (#243)

* Highlight backport rules

* Add backport rules

* Add backport rules

* Use organization secret NPM_ORG_TOKEN (#231)

* Fix link in README and CONTRIBUTING. Fix typo in README. (#237)

* one yarn forgotten (#242)

Co-authored-by: Marcel Normann <marcel.normann@wheregroup.com>
Co-authored-by: Oliver Wipfli <oliver.wipfli@leichteralsluft.ch>
Co-authored-by: tunnelpuzzle <79618312+tunnelpuzzle@users.noreply.github.com>

* Update Life of a tile docs (#247)

* rename .js to .ts in doc/life-of-a-tile.md

* Update Developer Doc - Life of a tile (#245)

* life of a tile

* correction

* Update package.json (#248)

* rename .js to .ts in doc/life-of-a-tile.md

* life of a tile

* correction

* package.json

* some updates from review (#252)

* Fix WritingMode cast (#254)

* Run CI on all pull requests (#255)

* Remove redundant parentheses (#257)

* Remove (minify = false)

* Review cleanup (#259)

* Remove redundant parentheses

* Remove eslint typescript exceptions

* Remove flow comments

* Remove `Number()` casts

* Remove parentheses

* Remove commented lint plugin

* Remove `HM TODO` comments

* Remove TODO, Fix according to code review changes

* Remove last TODOs.

* Updated changelog

* Change publish style spec to reflect latest changes in typescript

* Fix code review comments

* Declare `emplace()` with variable number of arguments (#262)

* Fix comment of generated files

* Fix according to code review

* remove comment and update type in jsdoc (#269)

* Copy dist folder with `cp -r` (#274)

* Fix typo

* Fix last comments about generated files.

* Fix typos in comments (#283)

* Remove polyfill support for IE11 (#284)

* Use native endsWith function

* Use native Object.values function

* Use native Number.MAX_SAFE_INTEGER value

* Fix typos, remove unused functions

The functions are already defined in `src/util/mapbox.ts`

* Enforce semicolons as member delimters (#282)

* eslint - enforce single quotes (#285)

Turn on @typescript-eslint/quotes rule to standardize on single quotes for all strings.

* move point.ts from symbol/ to util/ (#287)

* move point.ts from symbol/ to util/

* Remove empty line

* Remove undefined as any casts (#292)

Unnecessary casts for 'undefined' or 'null' as 'any'.

* Remove feature detection for {passive: false} support (#291)

* Changed version in package.json before merge

* Remove the usage of devicePixelRatio as a getter from browser.ts (#294)

Co-authored-by: Oliver Wipfli <oliver.wipfli@leichteralsluft.ch>
Co-authored-by: James Hamilton <chippieTV@users.noreply.github.com>
Co-authored-by: Astrid <astridx@users.noreply.github.com>
Co-authored-by: Marcel Normann <marcel.normann@wheregroup.com>
Co-authored-by: tunnelpuzzle <79618312+tunnelpuzzle@users.noreply.github.com>
Co-authored-by: Frédéric Junod <frederic.junod@camptocamp.com>
Co-authored-by: Derek Westcott <drwestco@gmail.com>
wipfli referenced this pull request in wipfli/maplibre-gl-js Sep 9, 2021
* Update README.md

* Initial commit - only rename and flow to typescript conversion

* Iint upgrade

* More lint fixes

* Updated lint command, added build typescript command

* Add non typed modules according to ts fork.

* Switch from yarn to npm

* Fix hasOwnProperty lint errors
See https://eslint.org/docs/rules/no-prototype-builtins
* I used this command for the conversions:
* sed -i -E "s/([\(\!])([]/[a-zA-Z_.-]*).hasOwnProperty\(/
\1Object.prototype.hasOwnProperty.call(\2, /g" <file-name>

* Fix extension from .js to .ts

* Remove types file

* Ignore lint errors

* Remove .ts extension in import

* Update CI from node v10 to v14

* Replace yarn with npm

* Remove circleci

* Fixed some typings errors

* Explicitly convert matrix-gl types

* Automatically fix lint errors

* Avoid Function as callback type

* Add missing MapOptions

* Add pitchWithRotate to MapOptions and pass explicit options to HandlerManager and Camera

* Set type of MapOptions.style to StyleSpecification of string

* Make Camera an abstract class

* Use Float32Array instead of Float64Array and cast types

* Make object dynamically extendable
See https://stackoverflow.com/questions/12710905/how-do-i-dynamically-assign-properties-to-an-object-in-typescript

* Make more objects dynamically extenable

* Explicit cast of array to length 2

* Do not provide type any in for..in loop

* Make more objects dynamically extenable

* Cast layout.get return value to Number

* Cast number | void to number

* Specify Rect type

* Make thhird argument of getKey optional

* Cast number | void to number

* Define return type of parse() in subclasses of Expression

* Cast return type of context.error() from void to null

* Cast style-spec types to Type

* Cast return type of context.error() from void to null

* Cast style-spec types to Type

* Cast dict to StylePropertySpecification

* Specify array type as any to fix string[] inference

* Make third argument of coalesce() optional

* Explicit casts to Evaluate, Varargs, and Signature

* Revert "Cast style-spec types to Type"

This reverts commit 4af74a6.

* Revert "Cast style-spec types to Type"

This reverts commit efc4b1f.

* Cast style-spec types at their source

* Typescript: Remove @mapbox/geojson-types and replace with @types/GeoJSON' (#221)

* remove @mapbox/geojson-types and replace with @types/GeoJSON

* update toJSON using spread operator

* add type to import GLSL as strings (#222)

* Typescript: Use library to handle Window type (#223)

* add window type lib

* remove internal window type file and use lib

* Fix issues related to possibly evaluated design

* Move IControl interface to a new class, Fix timeoutID type.

* remove flow-typed folder (#225)

* Typescript: Remove reference to @mapbox/point-geometry TBC (#226)

* Remove reference to @mapbox/point-geometry and replace with local point module with types
Remove commented out types
Fix cannot find type Point errors
Add static to fix convert does not exist on typeof Point errors

* Remove @mapbox/point-geometry from packkage.json

* Fix lint

* Typescript: fix lint and update .eslintrc with alternate TS rule (#227)

* fix lint and .eslintrc with alternate TS rule

* remove comment

* Typescript: a number of minor fixes from WIP branch (#228)

* fix minor ID type issues

* minor casting fix non bool to bool

* fix thrown Error message issue

* fix a couple of import issues

* match date comparison types

* remove commented out code

* fixes from WIP branch

* remove redundant import for lint

* more fixes

* Fix small typings issues

* More typescript fixes

* More fixes to typings, lint fixes

* Change base calls to be abstract

* More type fixes

* More types fixes

* More types fixes

* update use of mat4 (#219)

updating types as gl-matrix
more types to gl-matrix
cleanup cast vs constructor
cleanup more gl-matrix types
more using gl-matrix instead of Float32Array
fixes from WIP squashed into one commit
minor cleanup and comments

* Added some "as any" to places in the code where the typing were not just right and the method are proplemeatic...

* More types fixing, not perfect but good enough.

* Fix last typescript errors

* Fix incorrect typings and code errors.

* Remove flow from rollup and add tsc to build

* Format file

* Fix rollup build

* Initial commit to make the render test run

* Remove unneeded window import from all files

* Remove version from API

* More mock fixes to be able to run tests

* fix running of test-expression (#232)

* Add build phase before running some of the tests

* Fix tests get stuck, still tests are failing...

* get node query tests running (#233)

* Fix mocking of case of tilejson implementation.

* Typescript: Fix unit-tests (#235)

* Move all referneces in unit test to use the build output

* Fixes to window related stuff in unit tests, fixes to unneeded requires.

* Fix to dem data test

* Fix tests - remove window restore, fix __dirname.

* Fix stub_loader due to function this usage.

* Fix more tests

* Fix tests and code that causes tests to fail.

* Fix usage of ajax.js by subbing it correctly

* Added missing window element to tests

* removing window in 2 places gains 1601 passing (#236)

* Adding missing windows to tests

* Fix tests, revert some changes from typescript migration

* More fixes related to removal of window

* remove warnings, fix attribution test

* Fix more tests

* Fix more tests

* Added missing stubs

* Fixed tests related to version removal

* More test fixes related to file path

* Typescript: unit tests Frustum issues (#238)

* fix minor file errors in stub_loader.js

* matrix tests pass but not sure the tests represent actual usage

* Fix primitive tests with minimal usage of "bad" types

* Minor fixes to reduce incorrect typings

* Fix image load for image source and style tests

* Fix tests, added missing stub_loader

* Fix uuid incorrect implemetation

* Fix ajax tests. imporved image mock

* Fix camera tests

* Revert changes related to incorrect typescript solution

Co-authored-by: James Hamilton <chippieTV@users.noreply.github.com>

* Incorrect invocation of build-dev...

* Fix lint errors

* Removed test flow

* Fix build csp, started to fix style build

* Fix css build

* Remove to vec3 as to code review requirements

* Remove flow from build in ci

* Remove references to @mapbox/point-geometry

* Allow building style-spec

* Fix build tests

* Remove window, fix missing references to FeatureIndex using typescript config, update rollup dependencies

* Fix lint

* Fix production build

* Remove buble, stop compiling for es5

* Added missing global definitions after removing window

* Fix tests, bring back web_worker mock file, fix maplibre-gl loading issue, revert tsconfig.

* Fix build?

* Fix lint

* Typescript: Fix query-tests (#240)

* Initial commit to fix query-tests

* Fix query tests

* Fix some lint issues

* Typescript: minor fixes to formatting (#241)

* minor fixes

* fix formatting of object key value types

* Remove unneeded comments

* Fix according to code review

* Remove undefined as any

* Fix according to code review requirements.

* Fix lint

* More lint cover and fixes

* Fix lint for windows, update versions.

* Fix browser tests due to incorrect lint fix

* Fix lint for land.html

* Fix minimal node version to 14

* Typescript: merge from main (#243)

* Highlight backport rules

* Add backport rules

* Add backport rules

* Use organization secret NPM_ORG_TOKEN (#231)

* Fix link in README and CONTRIBUTING. Fix typo in README. (#237)

* one yarn forgotten (#242)

Co-authored-by: Marcel Normann <marcel.normann@wheregroup.com>
Co-authored-by: Oliver Wipfli <oliver.wipfli@leichteralsluft.ch>
Co-authored-by: tunnelpuzzle <79618312+tunnelpuzzle@users.noreply.github.com>

* Update Life of a tile docs (#247)

* rename .js to .ts in doc/life-of-a-tile.md

* Update Developer Doc - Life of a tile (#245)

* life of a tile

* correction

* Update package.json (#248)

* rename .js to .ts in doc/life-of-a-tile.md

* life of a tile

* correction

* package.json

* some updates from review (#252)

* Fix WritingMode cast (#254)

* Run CI on all pull requests (#255)

* Remove redundant parentheses (#257)

* Remove (minify = false)

* Review cleanup (#259)

* Remove redundant parentheses

* Remove eslint typescript exceptions

* Remove flow comments

* Remove `Number()` casts

* Remove parentheses

* Remove commented lint plugin

* Remove `HM TODO` comments

* Remove TODO, Fix according to code review changes

* Remove last TODOs.

* Updated changelog

* Change publish style spec to reflect latest changes in typescript

* Fix code review comments

* Declare `emplace()` with variable number of arguments (#262)

* Fix comment of generated files

* Fix according to code review

* remove comment and update type in jsdoc (#269)

* Copy dist folder with `cp -r` (#274)

* Fix typo

* Fix last comments about generated files.

* Fix typos in comments (#283)

* Remove polyfill support for IE11 (#284)

* Use native endsWith function

* Use native Object.values function

* Use native Number.MAX_SAFE_INTEGER value

* Fix typos, remove unused functions

The functions are already defined in `src/util/mapbox.ts`

* Enforce semicolons as member delimters (#282)

* eslint - enforce single quotes (#285)

Turn on @typescript-eslint/quotes rule to standardize on single quotes for all strings.

* move point.ts from symbol/ to util/ (#287)

* move point.ts from symbol/ to util/

* Remove empty line

* Remove undefined as any casts (#292)

Unnecessary casts for 'undefined' or 'null' as 'any'.

* Remove feature detection for {passive: false} support (#291)

* Changed version in package.json before merge

* Remove the usage of devicePixelRatio as a getter from browser.ts (#294)

Co-authored-by: Oliver Wipfli <oliver.wipfli@leichteralsluft.ch>
Co-authored-by: James Hamilton <chippieTV@users.noreply.github.com>
Co-authored-by: Astrid <astridx@users.noreply.github.com>
Co-authored-by: Marcel Normann <marcel.normann@wheregroup.com>
Co-authored-by: tunnelpuzzle <79618312+tunnelpuzzle@users.noreply.github.com>
Co-authored-by: Frédéric Junod <frederic.junod@camptocamp.com>
Co-authored-by: Derek Westcott <drwestco@gmail.com>
acalcutt referenced this pull request in acalcutt/maplibre-gl-js Dec 3, 2021
* Update README.md

* Initial commit - only rename and flow to typescript conversion

* Iint upgrade

* More lint fixes

* Updated lint command, added build typescript command

* Add non typed modules according to ts fork.

* Switch from yarn to npm

* Fix hasOwnProperty lint errors
See https://eslint.org/docs/rules/no-prototype-builtins
* I used this command for the conversions:
* sed -i -E "s/([\(\!])([]/[a-zA-Z_.-]*).hasOwnProperty\(/
\1Object.prototype.hasOwnProperty.call(\2, /g" <file-name>

* Fix extension from .js to .ts

* Remove types file

* Ignore lint errors

* Remove .ts extension in import

* Update CI from node v10 to v14

* Replace yarn with npm

* Remove circleci

* Fixed some typings errors

* Explicitly convert matrix-gl types

* Automatically fix lint errors

* Avoid Function as callback type

* Add missing MapOptions

* Add pitchWithRotate to MapOptions and pass explicit options to HandlerManager and Camera

* Set type of MapOptions.style to StyleSpecification of string

* Make Camera an abstract class

* Use Float32Array instead of Float64Array and cast types

* Make object dynamically extendable
See https://stackoverflow.com/questions/12710905/how-do-i-dynamically-assign-properties-to-an-object-in-typescript

* Make more objects dynamically extenable

* Explicit cast of array to length 2

* Do not provide type any in for..in loop

* Make more objects dynamically extenable

* Cast layout.get return value to Number

* Cast number | void to number

* Specify Rect type

* Make thhird argument of getKey optional

* Cast number | void to number

* Define return type of parse() in subclasses of Expression

* Cast return type of context.error() from void to null

* Cast style-spec types to Type

* Cast return type of context.error() from void to null

* Cast style-spec types to Type

* Cast dict to StylePropertySpecification

* Specify array type as any to fix string[] inference

* Make third argument of coalesce() optional

* Explicit casts to Evaluate, Varargs, and Signature

* Revert "Cast style-spec types to Type"

This reverts commit 4af74a6.

* Revert "Cast style-spec types to Type"

This reverts commit efc4b1f.

* Cast style-spec types at their source

* Typescript: Remove @mapbox/geojson-types and replace with @types/GeoJSON' (#221)

* remove @mapbox/geojson-types and replace with @types/GeoJSON

* update toJSON using spread operator

* add type to import GLSL as strings (#222)

* Typescript: Use library to handle Window type (#223)

* add window type lib

* remove internal window type file and use lib

* Fix issues related to possibly evaluated design

* Move IControl interface to a new class, Fix timeoutID type.

* remove flow-typed folder (#225)

* Typescript: Remove reference to @mapbox/point-geometry TBC (#226)

* Remove reference to @mapbox/point-geometry and replace with local point module with types
Remove commented out types
Fix cannot find type Point errors
Add static to fix convert does not exist on typeof Point errors

* Remove @mapbox/point-geometry from packkage.json

* Fix lint

* Typescript: fix lint and update .eslintrc with alternate TS rule (#227)

* fix lint and .eslintrc with alternate TS rule

* remove comment

* Typescript: a number of minor fixes from WIP branch (#228)

* fix minor ID type issues

* minor casting fix non bool to bool

* fix thrown Error message issue

* fix a couple of import issues

* match date comparison types

* remove commented out code

* fixes from WIP branch

* remove redundant import for lint

* more fixes

* Fix small typings issues

* More typescript fixes

* More fixes to typings, lint fixes

* Change base calls to be abstract

* More type fixes

* More types fixes

* More types fixes

* update use of mat4 (#219)

updating types as gl-matrix
more types to gl-matrix
cleanup cast vs constructor
cleanup more gl-matrix types
more using gl-matrix instead of Float32Array
fixes from WIP squashed into one commit
minor cleanup and comments

* Added some "as any" to places in the code where the typing were not just right and the method are proplemeatic...

* More types fixing, not perfect but good enough.

* Fix last typescript errors

* Fix incorrect typings and code errors.

* Remove flow from rollup and add tsc to build

* Format file

* Fix rollup build

* Initial commit to make the render test run

* Remove unneeded window import from all files

* Remove version from API

* More mock fixes to be able to run tests

* fix running of test-expression (#232)

* Add build phase before running some of the tests

* Fix tests get stuck, still tests are failing...

* get node query tests running (#233)

* Fix mocking of case of tilejson implementation.

* Typescript: Fix unit-tests (#235)

* Move all referneces in unit test to use the build output

* Fixes to window related stuff in unit tests, fixes to unneeded requires.

* Fix to dem data test

* Fix tests - remove window restore, fix __dirname.

* Fix stub_loader due to function this usage.

* Fix more tests

* Fix tests and code that causes tests to fail.

* Fix usage of ajax.js by subbing it correctly

* Added missing window element to tests

* removing window in 2 places gains 1601 passing (#236)

* Adding missing windows to tests

* Fix tests, revert some changes from typescript migration

* More fixes related to removal of window

* remove warnings, fix attribution test

* Fix more tests

* Fix more tests

* Added missing stubs

* Fixed tests related to version removal

* More test fixes related to file path

* Typescript: unit tests Frustum issues (#238)

* fix minor file errors in stub_loader.js

* matrix tests pass but not sure the tests represent actual usage

* Fix primitive tests with minimal usage of "bad" types

* Minor fixes to reduce incorrect typings

* Fix image load for image source and style tests

* Fix tests, added missing stub_loader

* Fix uuid incorrect implemetation

* Fix ajax tests. imporved image mock

* Fix camera tests

* Revert changes related to incorrect typescript solution

Co-authored-by: James Hamilton <chippieTV@users.noreply.github.com>

* Incorrect invocation of build-dev...

* Fix lint errors

* Removed test flow

* Fix build csp, started to fix style build

* Fix css build

* Remove to vec3 as to code review requirements

* Remove flow from build in ci

* Remove references to @mapbox/point-geometry

* Allow building style-spec

* Fix build tests

* Remove window, fix missing references to FeatureIndex using typescript config, update rollup dependencies

* Fix lint

* Fix production build

* Remove buble, stop compiling for es5

* Added missing global definitions after removing window

* Fix tests, bring back web_worker mock file, fix maplibre-gl loading issue, revert tsconfig.

* Fix build?

* Fix lint

* Typescript: Fix query-tests (#240)

* Initial commit to fix query-tests

* Fix query tests

* Fix some lint issues

* Typescript: minor fixes to formatting (#241)

* minor fixes

* fix formatting of object key value types

* Remove unneeded comments

* Fix according to code review

* Remove undefined as any

* Fix according to code review requirements.

* Fix lint

* More lint cover and fixes

* Fix lint for windows, update versions.

* Fix browser tests due to incorrect lint fix

* Fix lint for land.html

* Fix minimal node version to 14

* Typescript: merge from main (#243)

* Highlight backport rules

* Add backport rules

* Add backport rules

* Use organization secret NPM_ORG_TOKEN (#231)

* Fix link in README and CONTRIBUTING. Fix typo in README. (#237)

* one yarn forgotten (#242)

Co-authored-by: Marcel Normann <marcel.normann@wheregroup.com>
Co-authored-by: Oliver Wipfli <oliver.wipfli@leichteralsluft.ch>
Co-authored-by: tunnelpuzzle <79618312+tunnelpuzzle@users.noreply.github.com>

* Update Life of a tile docs (#247)

* rename .js to .ts in doc/life-of-a-tile.md

* Update Developer Doc - Life of a tile (#245)

* life of a tile

* correction

* Update package.json (#248)

* rename .js to .ts in doc/life-of-a-tile.md

* life of a tile

* correction

* package.json

* some updates from review (#252)

* Fix WritingMode cast (#254)

* Run CI on all pull requests (#255)

* Remove redundant parentheses (#257)

* Remove (minify = false)

* Review cleanup (#259)

* Remove redundant parentheses

* Remove eslint typescript exceptions

* Remove flow comments

* Remove `Number()` casts

* Remove parentheses

* Remove commented lint plugin

* Remove `HM TODO` comments

* Remove TODO, Fix according to code review changes

* Remove last TODOs.

* Updated changelog

* Change publish style spec to reflect latest changes in typescript

* Fix code review comments

* Declare `emplace()` with variable number of arguments (#262)

* Fix comment of generated files

* Fix according to code review

* remove comment and update type in jsdoc (#269)

* Copy dist folder with `cp -r` (#274)

* Fix typo

* Fix last comments about generated files.

* Fix typos in comments (#283)

* Remove polyfill support for IE11 (#284)

* Use native endsWith function

* Use native Object.values function

* Use native Number.MAX_SAFE_INTEGER value

* Fix typos, remove unused functions

The functions are already defined in `src/util/mapbox.ts`

* Enforce semicolons as member delimters (#282)

* eslint - enforce single quotes (#285)

Turn on @typescript-eslint/quotes rule to standardize on single quotes for all strings.

* move point.ts from symbol/ to util/ (#287)

* move point.ts from symbol/ to util/

* Remove empty line

* Remove undefined as any casts (#292)

Unnecessary casts for 'undefined' or 'null' as 'any'.

* Remove feature detection for {passive: false} support (#291)

* Changed version in package.json before merge

* Remove the usage of devicePixelRatio as a getter from browser.ts (#294)

Co-authored-by: Oliver Wipfli <oliver.wipfli@leichteralsluft.ch>
Co-authored-by: James Hamilton <chippieTV@users.noreply.github.com>
Co-authored-by: Astrid <astridx@users.noreply.github.com>
Co-authored-by: Marcel Normann <marcel.normann@wheregroup.com>
Co-authored-by: tunnelpuzzle <79618312+tunnelpuzzle@users.noreply.github.com>
Co-authored-by: Frédéric Junod <frederic.junod@camptocamp.com>
Co-authored-by: Derek Westcott <drwestco@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants