Skip to content

Instantly share code, notes, and snippets.

View vjau's full-sized avatar

Vincent Jaubert vjau

View GitHub Profile
@vjau
vjau / isExactOptional.ts
Created September 16, 2023 13:01
Utility Typescript Type to know when exactOptionalPropertyTypes is set
type _Intersect = {a?:number} & {a:number|undefined};
//state of exactOptionalPropertyTypes
type IsExactOptional = _Intersect["a"] extends Exclude<_Intersect["a"], undefined> ? true : false;
@vjau
vjau / Exemple.js
Last active January 20, 2017 03:52
nigthwatch command to fake Date in the browser. Put this in a commands folder and set the folder name in nightwatch.json "custom_commands_path" : "./commands",
module.exports = {
"we go on the page": function(browser){
browser
.url("http://localhost:3000")
.waitForElementVisible("#stuff", 10000)
.assert.title("MyPage")
},
"we fake the Date": function(browser){
browser
.fakeDate(new Date(2001, 1, 1).getTime()) //DONE !