profile
viewpoint
Kevin Simper kevinsimper Blackbeard Copenhagen, Denmark https://www.kevinsimper.dk Working on electric car sharing at @greenmobility

chklueter/code-of-conduct 1

Code of conduct for HackYourFuture Copenhagen

HackYourFuture-CPH/teaching-instructions 1

Step-by-step guide for new (and old) teachers

kevinsimper/berglas 1

A tool for managing secrets on Google Cloud

copenhagenjs/meetup-slides 0

The welcome presentations from each month meetups.

inga-balcune/countries-of-the-world 0

Countries of the World is my first serious front end web development project and first repository on Github

kevinsimper/aenea 0

Client-server library for using voice macros from Dragon NaturallySpeaking and Dragonfly on remote/non-windows hosts.

kevinsimper/akasse 0

Info om akasser

kevinsimper/alpine-caddy 0

Alpine Linux Docker Container running Caddyserver

push eventkevinsimper/dotfiles

Kevin Simper

commit sha 1608debf90d712929b7626d6683ea34f2f4ce51f

Create .bashrc

view details

push time in 7 days

issue commentvultix/ts-results

Errors in typescript 4.1

Otherwise the example could be changed to something like:

import {Ok, Err, Result} from 'ts-results';

enum ReadFileErrors { INVALIDPATH = 'invalid path' }
function readFile(path: string): Result<string, ReadFileErrors> {
    if (path) {
        return new Ok(path); // new is optional here
    } else {
        return new Err(ReadFileErrors.INVALIDPATH); // new is optional here
    }
}

// Typescript now forces you to check whether you have a valid result at compile time.
const result = readFile('test.txt');
if (result.ok) {
    // text contains the file's content
    const text = result.val;
    console.log(text)
} else {
    // err equals 'invalid path'
    const err = result.val;
    console.log(err)
}
kevinsimper

comment created time in 7 days

issue commentvultix/ts-results

Errors in typescript 4.1

@vultix Thanks for responding, so the example in the README.md has to be updated when typescript 4.1 is released? https://github.com/vultix/ts-results#example

Because the example does not work in 4.1 as is.

kevinsimper

comment created time in 7 days

issue openedvultix/ts-results

Errors in typescript 4.1

Typescript 4.1 changes some things and ts-results does not work.

https://devblogs.microsoft.com/typescript/announcing-typescript-4-1-beta/

I am not entirely sure, but it can be seen here

https://www.typescriptlang.org/play?ts=4.1.0-dev.20201015#code/JYWwDg9gTgLgBAbwPIGsA0cCiUoYEoCmAzgK4A2MAvnAGZQQhwDkMRAtFMea0wNwBQ-GiQB2AYxjAIIuJwCGAEwBiwMgQAUYOTAAWALjhEYUYCIDmASgOFSFADxGT5jE1MA3OWWAK4W3UwA+RH44ULhgGjhNbR0LYLCE2QIYEigZEQIAdzhUaN0LXjgAeiK4DOzgIjgIMElpTzgdAk4QsOoCMiICeMTQzhS0sqysHHUAIndPb18YsYLi0vLwqpq6kQamloTKfh3+ErgAFQBPMGIxE1qyiGyaaDFiOGOIEjgYCDgxJrEUOEym3TNJ4vRpyNzdORwDxeHycWzwbSfBhgVTdSQgAgAOn4YmkRiS8LgAF4kooVGp1CxiDBMTAAB4wJgFfgRKJw7iYiAoOIIVqhA4wAgMpEiGByUxVQG0VFMKq40UEUV8kX4wXCknsiiY6ECBLyogQNSYsgQMzqNUwCy7OAdLo9fmlZpQG0ARxIniqrhE0Omfh0TGV+vgTuJBI5OsDeMNWJNZqdVsoQA

Type 'Err<string>' is not assignable to type 'Result<string, "invalid path">'. Type 'Err<string>' is not assignable to type 'Err<"invalid path"> & BaseResult<string, "invalid path">'. Type 'Err<string>' is not assignable to type 'Err<"invalid path">'. Type 'string' is not assignable to type '"invalid path"'.
import {Ok, Err, Result} from 'ts-results';

function readFile(path: string): Result<string, 'invalid path'> {
    if (path) {
        return new Ok(path); // new is optional here
    } else {
        return new Err("invalid path"); // new is optional here
    }
}

// Typescript now forces you to check whether you have a valid result at compile time.
const result = readFile('test.txt');
if (result.ok) {
    // text contains the file's content
    const text = result.val;
    console.log(text)
} else {
    // err equals 'invalid path'
    const err = result.val;
    console.log(err)
}

created time in 11 days

startedmikeal/dkv

started time in 12 days

push eventkevinsimper/zod-generate

Kevin Simper

commit sha c6673ad02fcf7efdbb51ced39dc03501ade25cfc

Publish cli

view details

push time in a month

push eventkevinsimper/zod-generate

Kevin Simper

commit sha d1572b034c5827e1cf83c160ff2b76a2c4ab8e0e

cli

view details

push time in a month

push eventkevinsimper/zod-generate

Kevin Simper

commit sha 94b4dd067a83af173c570877e4047fa8b7bf595c

Allow publishing as ts package

view details

push time in a month

push eventkevinsimper/zod-generate

Kevin Simper

commit sha f8f7e9b7d95c06fc21da570bd1cefea95072e842

Add simple zod generator

view details

push time in a month

push eventkevinsimper/zod-generate

Kevin Simper

commit sha 311ea434f6370cae9b8b8d3750ed78ce693c455a

Basic typescript jest test setup

view details

push time in a month

create barnchkevinsimper/zod-generate

branch : master

created branch time in a month

created repositorykevinsimper/zod-generate

created time in a month

create barnchkevinsimper/localsearch

branch : cliplanid

created branch time in a month

push eventkevinsimper/kevinsimper

Kevin Simper

commit sha 120522ed76b06a486fb890114750c5029c763f5b

Update README.md

view details

push time in 2 months

create barnchkevinsimper/kevinsimper

branch : master

created branch time in 2 months

created repositorykevinsimper/kevinsimper

created time in 2 months

push eventgreenmobility/engineering

Kevin Simper

commit sha 08b46b65f43cd7f8c23c7eb334e5c2a98e94674f

Update README.md

view details

push time in 2 months

push eventgreenmobility/engineering

Kevin Simper

commit sha 9f4daf3215593c828cc83c78a094e1fe4cb5f3cc

Update README.md

view details

push time in 2 months

push eventgreenmobility/engineering

Kevin Simper

commit sha 5a5d6906acb87345574b6c9a87f9b567042be7ee

Update README.md

view details

push time in 2 months

push eventgreenmobility/engineering

Kevin Simper

commit sha 324115d90aed1395cde38fa94da3d7697346fc73

Update README.md

view details

push time in 2 months

create barnchgreenmobility/engineering

branch : master

created branch time in 2 months

created repositorygreenmobility/engineering

created time in 2 months

issue commentvercel/next.js

Allow shallow rounting on `pathname` - leading to Router bug

I also tried using first router.replace() but that made the page think is has to reload.

As @Alecell I tried using history.pushState, but that breaks the navigation back in Next.js. When you go back, you don't go to the previous page, you stay on the same but the URL change.

Alecell

comment created time in 2 months

issue closedsindresorhus/conf

Example from readme with typescript

I tried the example and it does not seem to compile

import Conf from 'conf'

const schema = {
	bar: {
		type: 'string'
	}
};

const config = new Conf({schema});

https://repl.it/repls/AliveLumberingTechnicians#index.ts

/usr/local/lib/node_modules/ts-node-fm/src/index.ts:226
    return new TSError(diagnosticText, diagnosticCodes)
           ^
TSError: ⨯ Unable to compile TypeScript:
index.ts:9:25 - error TS2345: Argument of type '{ schema: { bar: { type: string; }; }; }' is not assignable to parameter of type 'Readonly<Partial<Options<{ bar: {}; }>>>'.
  Types of property 'schema' are incompatible.
    Type '{ bar: { type: string; }; }' is not assignable to type 'Schema<{ bar: {}; }>'.
      Types of property 'bar' are incompatible.
        Type '{ type: string; }' is not assignable to type 'JSONSchema'.
          Types of property 'type' are incompatible.
            Type 'string' is not assignable to type '"string" | "number" | "boolean" | "object" | JSONSchemaType | "array" | "integer" | "null" | ("string" | "number" | "boolean" | "object" | JSONSchemaType | "array" | "integer" | "null")[] | undefined'.

9 const config = new Conf({schema});
                          ~~~~~~~~

    at createTSError (/usr/local/lib/node_modules/ts-node-fm/src/index.ts:226:12)
    at getOutput (/usr/local/lib/node_modules/ts-node-fm/src/index.ts:335:40)
    at Object.compile (/usr/local/lib/node_modules/ts-node-fm/src/index.ts:368:11)
    at startRepl (/usr/local/lib/node_modules/ts-node-fm/src/bin.ts:147:28)
    at Object.<anonymous> (/usr/local/lib/node_modules/ts-node-fm/src/bin.ts:66:1)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)

closed time in 2 months

kevinsimper

issue commentsindresorhus/conf

Example from readme with typescript

Some good solutions has come up 👍

kevinsimper

comment created time in 2 months

delete branch kevinsimper/conf

delete branch : kevinsimper-const-typescript

delete time in 2 months

PR closed sindresorhus/conf

Adding schema as a variable will not work

It will complain if you add it like this, but not if you define it inside.

I have no idea why, I don't know enough about typescript to know the difference.

+24 -0

7 comments

1 changed file

kevinsimper

pr closed time in 2 months

pull request commentsindresorhus/conf

Adding schema as a variable will not work

@SnosMe Thank you, did not know that 👍 But I don't understand why it would not be const when defined as a const

kevinsimper

comment created time in 2 months

issue openedpinojs/pino

Access to child object in logMethod

I was looking to access the child object, I want to make so that it prepends the message object.

Here I log what inputArgs contains inside hooks.logMethod

after having called logger.child({"featureName":"MY FEATURE"}

{ inputArgs: [ 'special' ] }
{"level":30,"time":1597765635449,"featureName":"MY FEATURE","message":"special"}

I am trying to make a function that will prepend that name to message, so it becomes

{"level":30,"time":1597765635449,"featureName":"MY FEATURE","message":"MY FEATURE: special"}

created time in 2 months

issue commentstorybookjs/storybook

Keyboard shortcuts on non-english keyboards

@tmeasday I can see you have worked in the shortcuts for storybook, that is super awesome! 👍 😄 Do you have an idea on how to solve this? What would be the approach?

kevinsimper

comment created time in 2 months

issue commentstorybookjs/storybook

Keyboard shortcuts on non-english keyboards

@Tomastomaslol Thank you 👍

Looking at the code I found something in UI, but the README also needs a update: https://github.com/storybookjs/storybook/blob/next/lib/ui/README.md#keyboard-shortcuts as src/modules/ui/configs/handle_routing.js does not exist inside ui anymore.

So the keyboard shortcuts are here: https://github.com/storybookjs/storybook/blob/00628f89134f1d3044baff46dd1c1543a37dca39/lib/api/src/modules/shortcuts.ts#L61

And it looks to be that the bug is looks if shiftKey is pressed down, which it is on non-english keyboards, but the shortcut does not specify it: https://github.com/storybookjs/storybook/blob/00628f89134f1d3044baff46dd1c1543a37dca39/lib/api/src/lib/shortcut.ts#L33

kevinsimper

comment created time in 2 months

issue openedstorybookjs/storybook

Keyboard shortcuts on non-english keyboards

Describe the bug If you use a non-english keyboards, the keyboard shortcuts does not work, for example "/".

To Reproduce I wrote a blogpost about it as it is a common a11y problem for non-native english programmers. https://medium.com/@kevinsimper/why-keyboard-shortcuts-and-accessibility-in-other-keyboard-languages-rarely-works-8638abc15e71

How to solve The reason is that a keycode integer is used instead of a key string to compare what was pressed.

created time in 2 months

issue openedhashicorp/terraform-provider-google

Error 403: The principal (user or service account) lacks IAM permission "cloudscheduler.jobs.create"

You get this error if you try to create a Cloud Scheduler Job in a region where your App Engine were not created.

So if config is this:

provider "google" {
  project = "my-project"
  region = "europe-west4"
}

but you region where you created App Engine is "europe-west1", it will not work. You will get this error:

Error: Error creating Job: googleapi: Error 403: The principal (user or service account) lacks IAM permission "cloudscheduler.jobs.create" for the resource "projects/my-project/locations/europe-west4" (or the resource may not exist).

However, if you change it to

resource "google_cloud_scheduler_job" "job" {
  region = "us-central1"
  ...
}

It will show you this error:

Error: Error creating Job: googleapi: Error 400: Location must equal europe-west1 because the App Engine app that is associated with this project is located in europe-west1

Which will help you set the correct error on the cloud scheduler job you create.

created time in 3 months

pull request commentsindresorhus/conf

Adding schema as a variable will not work

@sindresorhus The weird thing is that the example in the readme does not work with how the types is, but I can't say why. I only copied the example index.test-d.ts and split it up with the variable schema.

kevinsimper

comment created time in 3 months

issue commentsindresorhus/conf

Example from readme with typescript

@sindresorhus I clone the repo and it is appearently down to how you define the schema, I am really confused: https://github.com/sindresorhus/conf/pull/121

The same error here: https://travis-ci.com/github/sindresorhus/conf/jobs/370496506

kevinsimper

comment created time in 3 months

PR closed kevinsimper/conf

Adding schema as a variable will not work

It will complain if you add it like this, but not if you define it inside.

I have no idea why, I don't know enough about typescript to know the difference.

+24 -0

0 comment

1 changed file

kevinsimper

pr closed time in 3 months

PR opened sindresorhus/conf

Adding schema as a variable will not work

It will complain if you add it like this, but not if you define it inside.

I have no idea why, I don't know enough about typescript to know the difference.

+24 -0

0 comment

1 changed file

pr created time in 3 months

PR opened kevinsimper/conf

Adding schema as a variable will not work

It will complain if you add it like this, but not if you define it inside.

I have no idea why, I don't know enough about typescript to know the difference.

+24 -0

0 comment

1 changed file

pr created time in 3 months

create barnchkevinsimper/conf

branch : kevinsimper-const-typescript

created branch time in 3 months

fork kevinsimper/conf

Simple config handling for your app or module

fork in 3 months

push eventkevinsimper/gcphelp-cli

Kevin Simper

commit sha 10c7464a9367fc98eef3401050ce689c3988db22

Update README.md

view details

push time in 3 months

release kevinsimper/gcphelp-cli

v1.5.0

released time in 3 months

created tagkevinsimper/gcphelp-cli

tagv1.5.0

A small set of tools that helps working with Kubernetes on Google Cloud Platform

created time in 3 months

push eventkevinsimper/gcphelp-cli

Kevin Simper

commit sha eeee7a1aac4792efe1ba4dc70fdd39f3fa955d1b

1.4.0

view details

Kevin Simper

commit sha 71963cab8656a17ae3f21226c4fd5c6d90477245

Adding command to package.json

view details

push time in 3 months

created tagkevinsimper/gcphelp-cli

tagv1.4.0

A small set of tools that helps working with Kubernetes on Google Cloud Platform

created time in 3 months

push eventkevinsimper/gcphelp-cli

Kevin Simper

commit sha 1cf5a221a623c0aad0b3b12bca2d93e21cfc08fa

Use function instead of creating a new session

view details

push time in 3 months

push eventkevinsimper/gcphelp-cli

Kevin Simper

commit sha 178bcb7ca94723370c8465ce595db2cc63fae9d9

Add authuser to logurl

view details

push time in 3 months

push eventkevinsimper/gcphelp-cli

Kevin Simper

commit sha 91ec857e1f0af65dd6d78a04f098f85fe4dd1b4e

Run only not if undefined

view details

push time in 3 months

push eventkevinsimper/gcphelp-cli

Kevin Simper

commit sha bcf2d1dc2725a83e0e0ef3cf3ef53a5169060120

Use the authuser that has been defined

view details

push time in 3 months

push eventkevinsimper/gcphelp-cli

Kevin Simper

commit sha 3e23c5ec58ade1fe84271eaa30bc1b2d2a57ad76

Allow setting the authuser

view details

push time in 3 months

issue openedsindresorhus/conf

Example from readme with typescript

I tried the example and it does not seem to compile

import Conf from 'conf'

const schema = {
	bar: {
		type: 'string'
	}
};

const config = new Conf({schema});

https://repl.it/repls/AliveLumberingTechnicians#index.ts

/usr/local/lib/node_modules/ts-node-fm/src/index.ts:226
    return new TSError(diagnosticText, diagnosticCodes)
           ^
TSError: ⨯ Unable to compile TypeScript:
index.ts:9:25 - error TS2345: Argument of type '{ schema: { bar: { type: string; }; }; }' is not assignable to parameter of type 'Readonly<Partial<Options<{ bar: {}; }>>>'.
  Types of property 'schema' are incompatible.
    Type '{ bar: { type: string; }; }' is not assignable to type 'Schema<{ bar: {}; }>'.
      Types of property 'bar' are incompatible.
        Type '{ type: string; }' is not assignable to type 'JSONSchema'.
          Types of property 'type' are incompatible.
            Type 'string' is not assignable to type '"string" | "number" | "boolean" | "object" | JSONSchemaType | "array" | "integer" | "null" | ("string" | "number" | "boolean" | "object" | JSONSchemaType | "array" | "integer" | "null")[] | undefined'.

9 const config = new Conf({schema});
                          ~~~~~~~~

    at createTSError (/usr/local/lib/node_modules/ts-node-fm/src/index.ts:226:12)
    at getOutput (/usr/local/lib/node_modules/ts-node-fm/src/index.ts:335:40)
    at Object.compile (/usr/local/lib/node_modules/ts-node-fm/src/index.ts:368:11)
    at startRepl (/usr/local/lib/node_modules/ts-node-fm/src/bin.ts:147:28)
    at Object.<anonymous> (/usr/local/lib/node_modules/ts-node-fm/src/bin.ts:66:1)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)

created time in 3 months

release kevinsimper/gcphelp-cli

v1.3.0

released time in 3 months

created tagkevinsimper/gcphelp-cli

tagv1.3.0

A small set of tools that helps working with Kubernetes on Google Cloud Platform

created time in 3 months

push eventkevinsimper/gcphelp-cli

Kevin Simper

commit sha a476a4b2a11903e6ebf3f49375b1c401337468ac

1.3.0

view details

push time in 3 months

push eventkevinsimper/gcphelp-cli

Kevin Simper

commit sha 5832e3d9cfe9691eeee7e2e2a2804f0639215cfc

Add run to executable

view details

push time in 3 months

push eventkevinsimper/gcphelp-cli

Kevin Simper

commit sha 849b19c67604967c0158c28a8c734a2d1f593581

Easily open cloud runs

view details

push time in 3 months

push eventkevinsimper/gcphelp-cli

Kevin Simper

commit sha e7989bd9622bba294143c7376ecab84552ae6009

Allow other cli's to change project

view details

push time in 3 months

push eventkevinsimper/gcphelp-cli

Kevin Simper

commit sha a27cb2073ce00c8a096d9031b05f802bcbc738af

Show what is current gcp status

view details

push time in 3 months

push eventkevinsimper/gcphelp-cli

Kevin Simper

commit sha 8cefd8ad2f34f88d0c47d29263caa340a842560a

Only run if run directly

view details

push time in 3 months

push eventkevinsimper/gcphelp-cli

Kevin Simper

commit sha 05c9b5d1b94b11e5819be430380673b200a61abe

Add build command

view details

push time in 3 months

push eventkevinsimper/gcphelp-cli

Kevin Simper

commit sha e369345615b2d9df05b194ec3c22dc7143c99afb

Point to the new dist files

view details

push time in 3 months

push eventkevinsimper/gcphelp-cli

Kevin Simper

commit sha 69bc164b75a0e89a646159b9a2ed0c98c0e25388

Convert files to typescript

view details

push time in 3 months

push eventkevinsimper/gcphelp-cli

Kevin Simper

commit sha fa7ca48ffd7fe590e30d7b1f1fb51827c398d0ed

Add typescript

view details

push time in 3 months

issue openedvriad/zod

Generic for parsing objects

Really enjoy the library! Thank you for the work!

To easier debug when a parse fails, I made a small wrapper like this:

function parse(parser, obj) {
  try {
    return parser.parse(obj);
  } catch (e) {
    console.log(obj);
    throw e;
  }
}

The problem is that typescript can not infer this function.

I tried multiple combinations but can not seem to get it right.

I looked through issues already mentioning generic and did fine one small example: https://github.com/vriad/zod/issues/93 but it did not help fully.

function parse<K, T extends z.ZodType<K, any>>(parser: T, obj): K {
  try {
    return parser.parse(obj);
  } catch (e) {
    console.log(obj);
    throw e;
  }
}
function parse<T extends z.ZodType<any, any>, K typeof T>(parser: T, obj): K {
  try {
    return parser.parse(obj);
  } catch (e) {
    console.log(obj);
    throw e;
  }
}
interface Schema<T> {
  parse: (data:unknown): T;
  check: (data:unknown): data is T;
}
function parse<T extends Schema<K>>(parser: T, obj) {
  try {
    return parser.parse(obj);
  } catch (e) {
    console.log(obj);
    throw e;
  }
}
interface SchemaVal {
  parse<K>(data: unknown): K;
}

function parse<T extends SchemaVal>(parser: T, obj): K {
  try {
    return parser.parse(obj);
  } catch (e) {
    console.log(obj);
    throw e;
  }
}

created time in 3 months

pull request commentleoek/fetch-to-curl

Fix examples that gives error in playground

It is pretty awesome project, makes it so easy to share reproducible bugs to companies which service one are using 😄👏

kevinsimper

comment created time in 3 months

delete branch kevinsimper/fetch-to-curl

delete branch : patch-1

delete time in 3 months

issue commentstorybookjs/storybook

Cannot build production Storybook: UnhandledPromiseRejectionWarning: [object Object]

I have the same error, haven't found it why, tried upgrading all my npm modules to latest but did not help:

$ npm run build-storybook

> build-storybook

info @storybook/react v5.3.19
info
info clean outputDir..
info => Copying prebuild dll's..
info => Building manager..
info => Loading manager config..
info => Loading presets
info => Compiling manager..
ERR! => Failed to build the manager
ERR! vendors~main.ecb8a10236cc8dbcfbb3.bundle.js from Terser
ERR! undefined
(node:38911) UnhandledPromiseRejectionWarning: [object Object]
(Use `node --trace-warnings ...` to show where the warning was created)
(node:38911) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:38911) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! xyz@1.0.0 build-storybook: `build-storybook`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the xyz@1.0.0 build-storybook script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/yyy/.npm/_logs/2020-07-28T14_40_05_137Z-debug.log
DanielRamosAcosta

comment created time in 3 months

push eventkevinsimper/fetch-to-curl

Kevin Simper

commit sha 3f0dcaddefabbf5bee138b2bbfec385f63ff99ad

Fix examples that gives error in playground

view details

push time in 3 months

fork kevinsimper/fetch-to-curl

Convert javascript fetch requests to curl

fork in 3 months

more